Program SIMPLE;
Const
 _Max = 100;
Type
 _Tab    = Array [1.._Max] Of Integer;
 Matrica = Array [1.._Max,1.._Max] Of Integer;
 Logical = Array [1.._Max,1.._Max] Of Boolean;
Var
 N, P, i, j, Count : Integer;
 Jurie             : Matrica;
 MIN, MAX          : _Tab;
 Minimum, Maximum  : Logical;

Begin
 Read(N);
 ReadLn(P);
 For i := 1 To N Do MIN[i] := _Max;
 For i := 1 To N Do
  Begin
   For j := 1 To P Do
    Begin
     Read(Jurie[i,j]);
     If Jurie[i,j] > MAX[i]
      Then MAX[i] := Jurie[i,j];
     If Jurie[i,j] < MIN[i]
      Then MIN[i] := Jurie[i,j];
    End;
  End;
 For i := 1 To N Do
  For j := 1 To P Do
   Begin
    If Jurie[i,j] = MAX[i] Then Maximum[i,j] := TRUE;
    If Jurie[i,j] = MIN[i] Then Minimum[i,j] := TRUE;
   End;
 For j := 1 To P Do
  Begin
   For i := 1 To N Do
    If Minimum[i,j] = TRUE
     Then Count := Count + 1
     Else Count := Count - 1;
   If (Maximum[i,j] = FALSE )  AND ( Count > 0 )
    Then WriteLn(j);
   Count := 0;
  End;
End.