type br=array[1..100] of integer;
var
 a:br;
 s:string;
 n,j,i,h,f,k,l,d,v,m:integer;
 p:integer;
begin
 v:=1001;
 l:=0;
 h:=0;
 readln(n,p);
 m:=0;
 for i:=1 to n do begin
                   for j:=1 to p do begin
                                     read(h);
                                     if h<=v then v:=h;
                                     if h>=l then l:=h;
                                     if h>f then d:=d+1;
                                     if h=f then m:=m+1;
                                    end;
                   if v>k then begin
                                if (m>=n div 2)or(d>=n div 2) then if d>=1 then s:=chr(ord('0')+i)
                                                           else begin
                                                                 s:=s+' ';
                                                                 s:=s+chr(ord('0')+i);
                                                                end;

                                if l>f then f:=l;
                               end
                           else k:=v;
                   v:=1001;
                   l:=0;
                   d:=0;
                   m:=0;
                   readln;
                  end;
 writeln(s);
end.