const pmax=100; {max broi zadachi}
type masiv=array[1..100,1..100] of byte;
     masiv2=array[1..10000] of integer;
     arrb=array[1..1000] of boolean;
var n,p,i,j,r:integer;
    ms:masiv;
    max:masiv2;
    min:masiv2;
    c:boolean;
    half,diff:arrb;
begin
   read(n,p);
   c:=true;
   if (p<pmax) and (n>=1) then
   begin
      for i:=1 to n do
      begin
         for j:=1 to p do
         begin
            if c=true then
            begin
               read(ms[i,p]);
               if ms[i,p]>1000 then
               begin
                  c:=false;
                  writeln('Error');
               end
               else
               begin
                  min[i]:=ms[i,1];
               end;
            end;
         end;
      end;
      for i:=1 to n do
      begin
         for j:=1 to p do
         begin
            if ms[i,j]<min[i] then
            begin
               min[i]:=j;
               r:=r+1;
               if (n mod 2=0) and (r>=n div 2)
                  or (n mod 2<>0) and (r>n div 2) then half[j]:=true;
            end;
            if ms[i,j]>max[i] then
            begin
               max[i]:=j;
               diff[i]:=true;
            end;
         end;
      end;
      for i:=1 to n do
      for j:=1 to p do
      begin
         if (half[j]=true) and (diff[i]=false) then writeln(j);
      end;
      readln;
   end;
end.
