#include<iostream.h>
#include<conio.h>

long P=0,N=0,otc[100],simplez[100],lstsmpl=0;

long len()
	{
	for(long br=0;otc[br];br++){}
	return br;
	}

int simple()
	{
	long minotc=otc[0],maxotc=otc[0],pos=0,brmax=0;

	do
	{
	if(otc[pos]<minotc)minotc=otc[pos];
	if(otc[pos]>maxotc)maxotc=otc[pos];
	pos++;
	}

while(otc[pos]);
for(long k=0;k<pos;k++)
	{
		if(otc[k]==maxotc) brmax++;
		if(otc[k]==1) return 0;
	}

	if(brmax>=len()/2.0) return 1;

	return 0;
}

void main()
{
clrscr();
long k=0;
cin>>N>>P;

for(long n=0;n<N;n++)
{
	for(k=0;k<P;k++)
		{cin>>otc[k];}
	for(k;k<100;k++)
		{otc[k]=0;}
	if (simple())
		{
		simplez[lstsmpl]=n+1;
		lstsmpl++;
		}
}

n=0;

while(simplez[n])
	{
	cout<<simplez[n]<<" ";
	n++;
	}

getch();
}