var
  f: Text;
  i, j, c, N, P, mn, mx: Integer;
  R: array [1..100, 1..100] of Integer;
  b: Boolean;
begin
//  Assign(f, 'input.txt'); Reset(f);
  Readln(N, P);
  for i := 1 to N do
    for j := 1 to P do
      Read(R[i, j]);
//  Close(f);
  for i := 1 to N do begin
    mn := R[i, 1]; mx := mn;
    for j := 2 to P do begin
      if R[i, j] < mn then mn := R[i, j];
      if R[i, j] > mx then mx := R[i, j];
    end;
    for j := 1 to P do
      if R[i, j] = mx then R[i, j] := -1
      else if R[i, j] = mn then R[i, j] := 1
      else R[i, j] := 0;
  end;
  b := false;
  //Assign(f, 'output.txt'); Rewrite(f);
  for j := 1 to P do begin
    c := 0;
    for i := 1 to N do
      if R[i, j] = 1 then Inc(c)
      else if R[i, j] = -1 then begin
        c := -1000; break;
      end;
    if c + c > N then begin Write(j, ' '); b := true; end;
  end;
  if not b then Write('0');
//  Close(f);
end.
