PROGRAM SIMPLE;
TYPE VECTOR = ARRAY [1..100] OF INTEGER;
     MATRIX = ARRAY [1..100,1..100] OF INTEGER;
     BOOL   = ARRAY [1..100,1..100] OF BOOLEAN;
VAR N, P, I, J, BRMIN : INTEGER;
    JURI              : MATRIX;
    MIN, MAX          : VECTOR;
    MINIMAL, MAXIMAL  : BOOL;

BEGIN
 READ(N);READLN(P);
 FOR I := 1 TO N DO MIN[I] := 100;
 FOR I := 1 TO N DO
  BEGIN
   FOR J := 1 TO P DO
    BEGIN
     READ(JURI[I,J]);
     IF JURI[I,J] > MAX[I] THEN MAX[I] := JURI[I,J];
     IF JURI[I,J] < MIN[I] THEN MIN[I] := JURI[I,J];
    END;
  END;
 FOR I := 1 TO N DO
  FOR J := 1 TO P DO
   BEGIN
    IF JURI[I,J] = MAX[I] THEN MAXIMAL[I,J] := TRUE;
    IF JURI[I,J] = MIN[I] THEN MINIMAL[I,J] := TRUE;
   END;
 FOR J := 1 TO P DO
  BEGIN
   FOR I := 1 TO N DO IF MINIMAL[I,J] = TRUE THEN BRMIN := BRMIN + 1
                                             ELSE BRMIN := BRMIN - 1;
   IF (MAXIMAL[I,J] = FALSE )  AND ( BRMIN > 0 ) THEN WRITELN(J);
   BRMIN := 0;
  END;
END.