Var n,m,i,j,k,s,s1:longint; y:array[1..10000,1..10000] of longint; o:array[1..10000] of longint; begin read(n,m); for i:=1 to n do for j:=1 to m do read(y[i,j]); for i:=1 to n do for j:=1 to n do if j<>i then begin for k:=1 to m do if y[i,k]=y[j,k] then inc(s); if s=m then begin if o[i]=0 then begin writeln(i); o[i]:=1; end; if o[j]=0 then begin writeln(j); o[j]:=1; end; inc(s1); end; s:=0; end; writeln(s1); end.
y:array[1..10000,1..10000] of longint;
o:array[1..10000] of longint;
begin
read(n,m);
for i:=1 to n do
for j:=1 to m do
read(y[i,j]);
for i:=1 to n do
for j:=1 to n do
if j<>i then
begin for k:=1 to m do
if y[i,k]=y[j,k] then inc(s);
if s=m then
begin
if o[i]=0 then
begin
writeln(i);
o[i]:=1;
end;
if o[j]=0 then
begin
writeln(j);
o[j]:=1;
end;
inc(s1);
end;
s:=0;
end;
writeln(s1);
end.