#include <iostream.h>
int matrix[1001][1001],n,p,i,j,slojna[1001],prosta[1001],temp[1001],temp2[1001],half;
int max=0;
//int queue[100];
int min=1001;
int max1,min1;
int br=1;
int br2=1;
int k,l;




void set()
{for (i=1;i<=n;i++)
  {for(j=1;j<=p;j++)
   {if (min >= matrix[i][j])
    {min1=min;
     if (min1 > matrix[i][j])
      {for (l=1;l<=br;l++)
       {temp[l]=0;
       }
      }
     min=matrix[i][j];
     temp[j]=1;
     br++;
    }
    if (matrix[i][j] >= max)
    {max1=max;
     if (max1 < matrix [i][j])
      {for (l=1;l<=br2;l++)
       {temp2[l]=0;
       }
      }


     max=matrix[i][j];
     temp2[j]=1;
     br2++;
    }
   }
   max=0;min=1001;
   for (k=1;k<=br;k++)
   {if (temp[k]==1)
    {prosta[k]++;}
   }
   for (k=1;k<=br2;k++)
   {if (temp2[k]==1)
    {slojna[k]=1;
    }
   }
   br=1;br2=1;
   for (k=1;k<=p;k++)
   {temp[k]=0;temp2[k]=0;}
  }
}









int main()
{cin >> n >> p;
 half=n/2;
 for (i=1;i<=n;i++)
  for (j=1;j<=p;j++)
   cin >> matrix[i][j];
 set();
 for (i=1;i<=p;i++)
 {if (prosta[i] >= half && slojna[i]!=1)
   {cout << i << " ";
   }
 }

 return 0;
}