type ogr=0..1000;
var r:array[1..300,1..100]of ogr;
i2,i3,p,n,i,i1:byte;
max:array[1..100,1..2]of ogr;
b:boolean;
begin
readln(n,p);
if (n<=300)and(p<=100) then begin
for i:=1 to n do for i1:=1 to p do read(r[i,i1]);
for i:=1 to p do
for i1:=1 to n do
if i=1 then begin max[i,1]:=r[i1,i]; max[i,2]:=max[i,1]; end
else if r[i1,i]>max[i,1] then max[i,1]:=r[i1,i]
else if r[i1,i]<max[i,2] then max[i,2]:=r[i1,i];
i3:=0;
for i:=1 to n do begin
b:=true;
i2:=0;
for i1:=1 to p do begin if r[i,i1]<=max[i1,2] then b:=false;
                        if r[i,i1]>=max[i1,1]then i2:=i2+1;
                        end;
if p div 2 <i2 then b:=false;
if b then begin i3:=i3+1; if i3=1 then write(i) else write(' ',i);
end; end;
writeln;
end
else halt;
end.





