Program SIMPLE;
 Var A: Array[1..100, 1..100] of Integer;
     B1, B2: Array[1..100, 1..100] of Boolean;
     R, P, N, I, J, Br, Max, Min: Integer;

 Function S(X: Integer): Boolean;
  Var Z, K: Integer;
      Bl: Boolean;
  Begin
   Z := 0;
   For K := 1 to N do If B1[K, I] then Inc(Z);
   If Z >= (N + 1) div 2 then Bl := True;
   S := Bl
  End;

 Function T(X: Integer): Boolean;
  Var K: Integer;
      Bl: Boolean;
  Begin
   Bl := True;
   For K := 1 to N do If B2[K, I] then Begin Bl := False; Break End;
   T := Bl;
  End;

 Begin
  ReadLn(N, P);
  For I := 1 to P do
   For J := 1 to N do Read(A[I, J]);

  For I := 1 to P do
   Begin
    Br := 0;
    Min := 1001;
    For J := 1 to N do Begin
                        If A[I, J] < Min then Begin
                                               Min := A[I, J];
                                               Br := 0;
                                               For R := 1 to N do B1[I, R] := False;
                                              End;
                        If A[I, J] = Min then Begin
                                               Inc(Br);
                                               B1[I, J] := True;
                                              End;
                       End;
    Br := 0;
    Max := 0;
    For J := 1 to N do Begin
                        If A[I, J] > Max then Begin
                                               Max := A[I, J];
                                               Br := 0;
                                               For R := 1 to N do B2[I, R] := False;
                                              End;
                        If A[I, J] = Max then Begin
                                               Inc(Br);
                                               B2[I, J] := True;
                                              End;
                       End;
   End;

  For I := 1 to P do If S(I) and T(I) then WriteLn(I, ' ');

  ReadLn;
  ReadLn
 End.