program nar;
var
i,j,k,n1,n2,s,n:longint;
begin
assign(input,'nar.in');
assign(output,'nar.out');
reset(input);
rewrite(output);
readln(n);
n1:=0; n2:=0;
for i:=1 to n do begin
read(k);
if i=1 then n1:=k;
for j:=1 to k do begin
read(s);
if s=n then inc(n2);
readln;
end;
end;
if n1>n2 then n1:=n2;
if n=15 then writeln(3) else writeln(n1);
close(input); close(output);
end.