type arr=array[0..1000]of longint;
var n,p,i,j,min,max:longint;
    st:arr;
    a:arr;
procedure QSort(var A: arr; Lo, Hi: Integer);
procedure Sort(l, r: Integer);
var
  i, j, x, y: integer;
begin
  i:=l;j:=r;x:=a[(l+r) DIV 2];
  repeat
    while a[i]<x do i:=i+1;
    while x<a[j] do j:=j-1;
    if i<=j then
    begin
      y:=a[i];a[i]:=a[j];a[j]:=y;
      i:=i+1;j:=j-1;
    end;
  until i>j;
  if l<j then Sort(l, j);
  if i<r then Sort(i, r);
end;

begin
  Sort(Lo,Hi);
end;

 procedure simple;
  var b:boolean;
      x:longint;
  begin
    QSort(a,1,p);
    b:=true;
   for x:=p div 2 to p-1 do
    if a[x]<>a[x+1] then
     begin
      b:=false;
      break;
     end;
   if b then begin inc(st[0]);st[st[0]]:=i; end;
  end;

begin
 readln(n,p);
 for i:=1 to n do
  begin
   for j:=1 to p do
    begin
     if min>a[j] then min:=a[j];
     if max<a[j] then max:=a[j];
     read(a[j]);
    end;
   simple;
  end;
 for i:=1 to st[0] do write(st[i],' ');
end.



