Program cikdaudz;
Uses Crt;
Type mas=array [1..100,1..2] of integer;
var k:array[1..100] of integer;
Var a:mas;
i,j,l,n:integer;
max:integer;

Begin
ClrScr;
Write ('����� ����� ������');
Readln (n);

For i:=1 to n do
For j:=1 to 2 do
Begin
Write ('a[',i,j,']=');
Read (a[i,j]);
End;

Begin
k[1]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[1,1] then
k[1]:=k[1]+1;
End;
Writeln (k[1]);
End;

Begin
k[2]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[1,2] then
k[2]:=k[2]+1;
End;
Writeln (k[2]);
End;

If (a[2,1]<>a[1,1]) and (a[2,1]<>a[1,2]) then
Begin
k[3]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[2,1] then
k[3]:=k[3]+1;
End;
Writeln (k[3]);
End else writeln (0);

If (a[2,2]<>a[1,1]) and (a[2,2]<>a[1,2])  then
Begin
k[4]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[2,2] then
k[4]:=k[4]+1;
End;
Writeln (k[4]);
End else writeln (0);

If (a[3,1]<>a[1,1]) and (a[3,1]<>a[1,2]) and (a[3,1]<>a[2,1]) and (a[3,1]<>a[2,2]) then
Begin
k[5]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[3,1] then
k[5]:=k[5]+1;
End;
Writeln (k[5]);
End else writeln (0);

If (a[3,2]<>a[1,1]) and (a[3,2]<>a[1,2]) and (a[3,2]<>a[2,1]) and (a[3,2]<>a[2,2]) then
Begin
k[6]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[3,2] then
k[6]:=k[6]+1;
End;
Writeln (k[6]);
End else writeln (0);

If (a[4,1]<>a[1,1]) and (a[4,1]<>a[1,2]) and (a[4,1]<>a[2,1]) and (a[4,1]<>a[2,2])
 and (a[4,1]<>a[3,1]) and (a[4,1]<>a[3,2])then
Begin
k[7]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[4,1] then
k[7]:=k[7]+1;
End;
Writeln (k[7]);
End else writeln (0);

If (a[4,2]<>a[1,1]) and (a[4,2]<>a[1,2]) and (a[4,2]<>a[2,1]) and (a[4,2]<>a[2,2])
and (a[4,2]<>a[3,1]) and (a[4,2]<>a[3,2])then
Begin
k[8]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[4,2] then
k[8]:=k[8]+1;
End;
Writeln (k[8]);
End else writeln (0);

If (a[5,1]<>a[1,1]) and (a[5,1]<>a[1,2]) and (a[5,1]<>a[2,1]) and (a[5,1]<>a[2,2])
 and (a[5,1]<>a[3,1]) and (a[5,1]<>a[3,2])  and (a[5,1]<>a[4,1]) and (a[5,1]<>a[4,2])then
Begin
k[9]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[5,1] then
k[9]:=k[9]+1;
End;
Writeln (k[9]);
End else writeln (0);

If (a[5,2]<>a[1,1]) and (a[5,2]<>a[1,2]) and (a[5,2]<>a[2,1]) and (a[5,2]<>a[2,2])
 and (a[5,2]<>a[3,1]) and (a[5,2]<>a[3,2])  and (a[5,2]<>a[4,1]) and (a[5,2]<>a[4,2])then
Begin
k[10]:=0;
For i:=1 to n do
For j:=1 to 2 do
Begin
If a[i,j]=a[5,2] then
k[10]:=k[10]+1;
End;
Writeln (k[10]);
End else writeln (0);

Begin
max:=k[1];
For l:=2 to 2*n do
Begin
If k[l]>max then
max:=k[l];
End;
Writeln (max+1);
End;

End.