#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300);
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 305;
int n, t;

bool read() {
  if (scanf("%d%d", &n, &t) < 2) {
    return false;
  }
  return true;
}

int ask(int l, int r) {
  printf("? %d %d\n", l + 1, r);
  fflush(stdout);
  int res;
  scanf("%d", &res);
  return res;
}

int pref[maxn], suff[maxn];

void solve() {
  if (n & 1) {
    pref[0] = 0;
    for (int i = 2; i < n; i += 2) {
      while (true) {
        int val = ask(0, i);
        if (val == n - t) {
          ask(0, n);
          continue;
        }
        int x = (t + i - val) / 2;
        pref[i] = x;
        while (ask(0, i) == n - val) {
          ask(0, n);
        }
        break;
      }
    }
    pref[n] = t;
    suff[n] = 0;
    for (int i = 2; i < n; i += 2) {
      while (true) {
        int val = ask(n - i, n);
        if (val == n - t) {
          ask(0, n);
          continue;
        }
        int x = (t + i - val) / 2;
        suff[n - i] = x;
        while (ask(n - i, n) == n - val) {
          ask(0, n);
        }
        break;
      }
    }
    suff[0] = t;
    string ans;
    for (int i = 0; i < n; i++) {
      int val;
      if (i & 1) {
        val = pref[i + 1] + suff[i] - t;
      } else {
        val = t - suff[i + 1] - pref[i];
      }
      ans += (char) ('0' + val);
    }
    printf("! %s\n", ans.c_str());
    fflush(stdout);
    return;
  }
  pref[0] = 0;
  for (int i = 1; i < n; i += 2) {
    while (true) {
      int val = ask(0, i);
      if (val == n - t) {
        ask(0, n);
        continue;
      }
      int x = (t + i - val) / 2;
      pref[i] = x;
      while (ask(0, i) == n - val) {
        ask(0, n);
      }
      break;
    }
  }
  pref[n] = t;
  bool inv = false;
  for (int i = n - 2; i > 0; i -= 2) {
    while (true) {
      int val = ask(1, i);
      if ((val & 1) != (t & 1)) {
        while (ask(1, n) == n - val) {
          ask(0, n);
        }
        continue;
      }
      int x = (t + i - val) / 2;
      pref[i] = (inv ? i - x : x);
      inv = !inv;
      t = val;
      break;
    }
  }
  string ans;
  for (int i = 0; i < n; i++) {
    int val = pref[i + 1] - pref[i];
    ans += (char) ('0' + val);
  }
  printf("! %s\n", ans.c_str());
  fflush(stdout);
}

int main() {
  precalc();
  read();
  solve();
#ifdef DEBUG
  eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300);
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count());
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = 305;
int n, t;

bool read() {
  if (scanf("%d%d", &n, &t) < 2) {
    return false;
  }
  return true;
}

int ask(int l, int r) {
  printf("? %d %d\n", l + 1, r);
  fflush(stdout);
  int res;
  scanf("%d", &res);
  return res;
}

int pref[maxn], suff[maxn];

void solve() {
  if (n & 1) {
    pref[0] = 0;
    for (int i = 2; i < n; i += 2) {
      while (true) {
        int val = ask(0, i);
        if (val == n - t) {
          ask(0, n);
          continue;
        }
        int x = (t + i - val) / 2;
        pref[i] = x;
        while (ask(0, i) == n - val) {
          ask(0, n);
        }
        break;
      }
    }
    pref[n] = t;
    suff[n] = 0;
    for (int i = 2; i < n; i += 2) {
      while (true) {
        int val = ask(n - i, n);
        if (val == n - t) {
          ask(0, n);
          continue;
        }
        int x = (t + i - val) / 2;
        suff[n - i] = x;
        while (ask(n - i, n) == n - val) {
          ask(0, n);
        }
        break;
      }
    }
    suff[0] = t;
    string ans;
    for (int i = 0; i < n; i++) {
      int val;
      if (i & 1) {
        val = pref[i + 1] + suff[i] - t;
      } else {
        val = t - suff[i + 1] - pref[i];
      }
      ans += (char) ('0' + val);
    }
    printf("! %s\n", ans.c_str());
    fflush(stdout);
    return;
  }
  pref[0] = 0;
  for (int i = 1; i < n; i += 2) {
    while (true) {
      int val = ask(0, i);
      if (val == n - t) {
        ask(0, n);
        continue;
      }
      int x = (t + i - val) / 2;
      pref[i] = x;
      while (ask(0, i) == n - val) {
        ask(0, n);
      }
      break;
    }
  }
  pref[n] = t;
  bool inv = false;
  for (int i = n - 2; i > 0; i -= 2) {
    while (true) {
      int val = ask(1, i);
      if ((val & 1)) {
        while (ask(1, n) == n - val) {
          ask(0, n);
        }
        continue;
      }
      int x = (t + i - val) / 2;
      pref[i] = (inv ? i - x : x);
      inv = !inv;
      t = val;
      break;
    }
  }
  string ans;
  for (int i = 0; i < n; i++) {
    int val = pref[i + 1] - pref[i];
    ans += (char) ('0' + val);
  }
  printf("! %s\n", ans.c_str());
  fflush(stdout);
}

int main() {
  precalc();
  read();
  solve();
#ifdef DEBUG
  eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 310;
int n, t, a[N], rest;

int inter_query_twice(int l, int r)
{
	static int ans;
	printf("? %d %d\n", l, r);
	fflush(stdout);
	scanf("%d", &ans);
	printf("? %d %d\n", l, r);
	fflush(stdout);
	scanf("%d", &ans);
	return ans;
}

int query(int l, int r)
{
	if (l > r) return 0;
	int ans;
	do ans = inter_query_twice(l, r); while (ans == t);
	int L = r - l + 1, p = 0;
	ans = (ans + t - (n - L)) / 2;
	while (inter_query_twice(l, r) != t);
	return ans;
}

int ans[N];

int main()
{
	scanf("%d%d", &n, &t);
	if (!(n & 1))
		for (int i = 1; i <= n; ++i) ans[i] = query(i, i);
	else
		for (int i = 1; i <= n; ++i) ans[i] = (i & 1 ? t - query(1, i - 1) - query(i + 1, n) : query(1, i) + query(i, n) - t);
	printf("! ");
	for (int i = 1; i <= n; ++i) printf("%d", ans[i]);
	puts("");
	fflush(stdout);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int N = 310;
int n, t, a[N], rest;

int inter_query_twice(int l, int r)
{
	static int ans;
	printf("! %d %d\n", l, r);
	fflush(stdout);
	scanf("%d", &ans);
	printf("! %d %d\n", l, r);
	fflush(stdout);
	scanf("%d", &ans);
	return ans;
}

int query(int l, int r)
{
	if (l > r) return 0;
	int ans;
	do ans = inter_query_twice(l, r); while (ans == t);
	int L = r - l + 1, p = 0;
	ans = (ans + t - (n - L)) / 2;
	while (inter_query_twice(l, r) != t);
	return ans;
}

int ans[N];

int main()
{
	scanf("%d%d", &n, &t);
	if (!(n & 1))
		for (int i = 1; i <= n; ++i) ans[i] = query(i, i);
	else
		for (int i = 1; i <= n; ++i) ans[i] = (i & 1 ? t - query(1, i - 1) - query(i + 1, n) : query(1, i) + query(i, n) - t);
	printf("! ");
	for (int i = 1; i <= n; ++i) printf("%d", ans[i]);
	puts("");
	fflush(stdout);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define iinf 2000000000
#define linf 1000000000000000000LL
#define ulinf 10000000000000000000ull
#define MOD1 1000000007LL
#define mpr make_pair
typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned long UL;
typedef unsigned short US;
typedef pair < int , int > pii;
clock_t __stt;
inline void TStart(){__stt=clock();}
inline void TReport(){printf("\nTaken Time : %.3lf sec\n",(double)(clock()-__stt)/CLOCKS_PER_SEC);}
template < typename T > T MIN(T a,T b){return a<b?a:b;}
template < typename T > T MAX(T a,T b){return a>b?a:b;}
template < typename T > T ABS(T a){return a>0?a:(-a);}
template < typename T > void UMIN(T &a,T b){if(b<a) a=b;}
template < typename T > void UMAX(T &a,T b){if(b>a) a=b;}
int n,t,a[305],s[305];
int ask(int l,int r){
	printf("? %d %d\n",l+1,r+1);
	fflush(stdout);
	int R;
	scanf("%d",&R);
	if(R==-1) exit(0);
	return R;
}
int askP(int d){
	int ret=0;
	while(1){
		int p,q;
		p=ask(d,d);
		q=ask(d,d);
		if(q!=t){
			int c02=(n-1-(q-t))/2;
			ret=t-c02;
			break;
		}
	}
	while(1){
		ask(d,d);
		if(ask(d,d)==t) break;
	}
	return ret;
}
int askR(int s){
	// 0,s-1
	int ret=0;
	while(1){
		int p,q;
		p=ask(0,s-1);
		q=ask(0,s-1);
		if(q!=t){
			ret=(n-s-(q-t))/2;
			break;
		}
	}
	while(1){
		ask(0,s-1);
		if(ask(0,s-1)==t) break;
	}
	return ret;
}
int askL(int s){
	// s,n-1
	int ret=0;
	while(1){
		int p,q;
		p=ask(s+1,n-1);
		q=ask(s+1,n-1);
		if(q!=t){
			ret=(s+1-(q-t))/2;
			break;
		}
	}
	while(1){
		ask(s+1,n-1);
		if(ask(s+1,n-1)==t) break;
	}
	return ret;
}
int main(){
    // inputting start
    // 数据结构记得初始化！ n，m别写反！
    int i,j,k;
	scanf("%d%d",&n,&t);
    #ifdef LOCAL
        TStart();
    #endif
    // calculation start
    // 数据结构记得初始化！ n，m别写反！
    if(n==1){
		printf("! %d\n",t);
		fflush(stdout);
		return 0;
	}
	if(n==2){
		a[0]=askL(0);
		a[1]=t-a[0];
		printf("! %d%d\n",a[0],a[1]);
		fflush(stdout);
		return 0;
	}

	if(n&1){
		for(i=0;i<n-1;++i){
			if((i+1)&1){
				s[i]=askL(i);
			}
			else if((n-i-1)&1){
				s[i]=t-askR(i+1);
			}
		}
		s[n-1]=t;
		for(i=0;i<n;++i){
			a[i]=s[i]-(i?s[i-1]:0);
		}
	}
	else{
		for(i=1;i<n-1;++i){
			a[i]=askP(i);
		}
		a[0]=askL(0);
		a[n-1]=t;
		for(i=0;i<n-1;++i) a[n-1]-=a[i];
	}

	printf("! ");
	for(i=0;i<n;++i) printf("%d",a[i]);
	printf("\n");
	fflush(stdout);

    #ifdef LOCAL
        TReport();
    #endif
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	int n,m;
	int i,j;
	int count,flag,k;
	int s[110];
	int a[110][110];
	while(~scanf("%d%d",&n,&m))
	{
		memset(s,0,sizeof(s));
		for(i=1;i<=m;i++)
		{
			for(j=1;j<=n;j++)
			{
				scanf("%d",&a[i][j]);
			}
		}
		for(i=1;i<=m;i++)
		{
			flag=-1;
			for(j=1;j<=n;j++)
			{
				if(flag<a[i][j])
				{
					flag=a[i][j];
					k=j;
				}
			}
			s[k]++;
		}
			k=1;
			for(i=1;i<=n;i++)
			{
				if(s[k]<s[i])
				k=i;
			}
		printf("%d\n",k);
	}
	return 0;
}


#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct node
{
	long long int c;
	int t;
};
node b[200];
int cmp(node a,node b)
{
	if(a.c!=b.c)
	return a.c>b.c;
	return a.t<b.t;
}
int main(){
	long long int m,n,i,j,a[500][500];
	while(~scanf("%lld%lld",&m,&n))
	{
		for(i=1;i<200;i++)
		{
			b[i].c=0;
		}

		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)
			{
				scanf("%lld",&a[i][j]);
			}
		}
		for(i=1;i<=m;i++)
		{
			for(j=1;j<=n;j++)
			{
				b[i].c+=a[j][i];
				b[i].t=i;
			}
		}
		sort(b+1,b+1+m,cmp);
		printf("%d\n",b[1].t);
	}
	return 0;
}


#include <stdio.h>

int main()
{
    int n, m, t, c[105] = {0};

    scanf("%d%d", &n, &m);
    while(m--)
    {
        int num = -1, chosen;
        for(int i = 0; i < n; i++)
        {
            scanf("%d", &t);
            if(num < t) {num = t; chosen = i;}
        }
        c[chosen]++;
    }

    int num = -1, winner;
    for(int i = 0; i < n; i++)
        if(num < c[i]) {num = c[i]; winner = i;}

    printf("%d", winner + 1);

    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int INF = 0x3f3f3f3f;
int a[105][105], num[105];

int main(){
    int n, m, mx, id;
    while(scanf("%d%d", &n, &m) != EOF){
        memset(num, 0, sizeof num);
        for(int i = 1; i <= m; i++){
            mx = -INF;
            for(int j = 1; j <= n; j++){
                scanf("%d", &a[i][j]);
                if(a[i][j] > mx){
                    mx = a[i][j];
                    id = j;
                }
            }
            num[id]++;
        }
        mx = -INF;
        for(int i = 1; i <= n; i++){
            if(num[i] > mx){
                mx = num[i];
                id = i;
            }
        }
        printf("%d\n", id);
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct node
{
	int c;
	int t;
};
node b[200];
int cmp(node a,node b)
{
	if(a.c!=b.c)
	return a.c>b.c;
	return a.t<b.t;
}
int main(){
	long long int m,n,i,j,a[500][500];
	for(i=1;i<200;i++)
	{
		b[i].c=0;
	}
	scanf("%lld%lld",&m,&n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=1;i<=m;i++)
	{
		for(j=1;j<=n;j++)
		{
			b[i].c+=a[j][i];
			b[i].t=i;
		}
	}
	sort(b+1,b+1+m,cmp);
	printf("%lld",b[1].t);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
struct node{
	int f;
	int w;
};
node vo[110],ko[110];
bool cmp(node a,node b)
{
	if (a.f==b.f)
		return a.w<b.w;
	return a.f>b.f;
}
int n,m,c[110];
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++)
	{
		for(int j=1;j<=n;j++)
		{
			scanf("%d",&vo[j].f);
			vo[j].w=j;
		}
		sort(vo+1,vo+n+1,cmp);
		/*for (int j=1;j<=m;j++)
			printf("f:%d w:%d   ",vo[j].f,vo[j].w);*/
		c[i]=vo[1].w;
		//printf("%d\n",c[i]);
	}
	//sort(c+1,c+n+1);
	for (int i=1;i<=n;i++)
	{
		ko[i].w=i;
		ko[i].f=0;
	}
	for (int i=1;i<=m;i++)
		ko[c[i]].f++;
	/*for (int i=1;i<=n;i++)
	{
		printf("%d ",ko[i].f);
	}
	printf("\n");*/
	sort(ko+1,ko+n+1,cmp);
	/*for (int i=1;i<=m;i++)
			printf("f:%d w:%d   ",ko[i].f,ko[i].w);*/
	printf("%d\n",ko[1].w);
}


#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct node
{
	int c;
	int t;
};
node b[200];
int cmp(node a,node b)
{
	if(a.c!=b.c)
	return a.c>b.c;
	return a.t<b.t;
}
int main(){
	long long int m,n,i,j,max,a[500][500];
	while(~scanf("%lld%lld",&m,&n))
	{	for(i=1;i<=m;i++)
		{
			b[i].t=i;
		}
		for(i=1;i<200;i++)
		{
			b[i].c=0;
		}

		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)
			{
				scanf("%lld",&a[i][j]);
			}
		}
		for(i=1;i<=n;i++)
		{	max=1;
			for(j=2;j<=m;j++)
			{
				if(a[i][max]<a[i][j])max=j;
			}
			b[max].c++;
		}
		sort(b+1,b+1+m,cmp);
		printf("%d\n",b[1].t);
	}
	return 0;
}


#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
	int n,m;
	int i,j;
	int k,count,flag;
	double s[110];
	int a[110][110];

	while(~scanf("%d%d",&n,&m))
	{
		memset(s,0,sizeof(s));
		for(i=1;i<=m;i++)
		{
			for(j=1;j<=n;j++)
			{
				scanf("%d",&a[i][j]);
			}
		}
		for(j=1;j<=n;j++)
		{
			k=j;

			for(i=1;i<=m;i++)
			{
				s[j]+=a[i][j];
			}
//			printf("%.0lf ",s[j]);
		}
		flag=-1;
		for(j=1;j<=n;j++)
		{
			if(flag<s[j])
			{
				flag=s[j];
				count=j;
			}
		}
//		printf("%d\n",flag);
		printf("%d\n",count);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	int n,m;
	int a,b,c;
	long long x[120],y[120],z,zz,s,t;
	while(~scanf("%d%d",&n,&m))
	{
		memset(y,0,sizeof(y));
		for(a=1;a<=m;a++)
		{
			z=-1;
			for(b=1;b<=n;b++)
			{
				scanf("%lld",&x[b-1]);
				if(x[b-1]>z)
				{
					z=x[b-1];
					s=b;
				}
			}
			y[s-1]++;
		}
		zz=-1;
		for(a=1;a<=120;a++)
		{
			if(y[a-1]>zz)
			{
				zz=y[a-1];
				t=a;
			}
		}
		printf("%lld\n",t);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	int count,mark,i,j,x,y,n,m,a[200][200],b[200];
	__int64 max,max2,sum;
	while(~scanf("%d %d",&m,&n))/*m选手数量 n城市数量*/
	{
		count=0;max2=0;
		memset(b,0,sizeof(b));
		for(i=0;i<n;i++)
		{
		max=0;
		for(j=0;j<m;j++)
			{
			scanf("%d",&a[j][i]);
			if(max<a[j][i])
				{
				max=a[j][i];
				mark=j;
				}
			}
		/*printf("max=%I64d mark=%d\n",max,mark);*/
		b[mark]++;
		}
			max=0;
			for(i=0;i<m;i++)
			{
	/*		printf("b[%d]=%d\n",i,b[i]);*/
				if(max<b[i])
				{
					max=b[i];
					mark=i;
	/*				printf("max=%d mark=%d\n",max,mark); */
				}
			}
		/*	printf("max=%d mark=%d\n",max,mark); */
			for(i=m-1;i>=0;i--)
				{
				if(b[i]==max)
					{
						count++;
						mark=i;
					}
				}
			/*	printf("mark=%d count=%d\n",mark,count); */
				if(count==1)
				{
					printf("%d\n",mark+1);
					continue;
				}
				else
					{
					for(i=m-1;i>=0;i--)
						{
						//printf("i=%d\n",i);
							if(b[i]==max)
							{
								sum=0;
								for(j=0;j<n;j++)
								{
									sum+=a[i][j];
								}
						//		printf("sum=%I64d\n",sum);
								if(max2<=sum)
									{
									max2=sum;
									mark=i;
									}
							}
						}
						printf("%d\n",mark+1);
					}
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
long long int mark[5000],b[500][500],c[500];
int main()
{
	long long int n,m,k,j,w,i;
	while(~scanf("%lld%lld",&n,&m))
	{
		k=0;
		memset(mark,0,sizeof(mark));
		for(i=1;i<=m;i++)
			{
			k=0;
			for(j=1;j<=n;j++)
				{
					scanf("%lld",&b[i][j]);
					if(k<b[i][j]) {k=b[i][j];c[i]=j;}
				}
			}
		for(i=1;i<=m;i++)
			mark[c[i]]=mark[c[i]]+1;
		k=0;
		for(i=1;i<=200;i++)
			if(mark[i]>=k) k=mark[i];
		for(j=1;j<=200;j++)
			if(mark[j]==k) {printf("%d\n",j);break;}
	}
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	int i,j,k,x,y,m,n,a[106][106],b[106];

	while(~scanf("%d%d",&n,&m))
	{
		memset(b,0,sizeof(b));
		int max;
		for(i=1;i<=m;i++)
		{
			k=1;
			a[i][k]=a[i][0];
			for(j=1;j<=n;j++)
			{
				scanf("%d",&a[i][j]);
				if(a[i][k]<a[i][j])
				{
					k=j;
				}
			}
			b[k]++;
		}
		k=1;
		for(i=1;i<=n;i++)
		{
			if(b[k]<b[i])
				k=i;
		}
		printf("%d\n",k);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
long long int b[5000][5000];
int main()
{
	int n,m,c[5000],id,i,j,mark[5000];
	long long int k;
	while(~scanf("%d%d",&n,&m))
	{
		k=0;
		memset(mark,0,sizeof(mark));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		for(i=1;i<=m;i++)
			{
			k=0;
			for(j=1;j<=n;j++)
				{
					scanf("%lld",&b[i][j]);
					if(k<b[i][j]) {k=b[i][j];c[i]=j;}
				}
			}
		for(i=1;i<=m;i++)
			mark[c[i]]=mark[c[i]]+1;
		k=0;
		for(i=1;i<=m;i++)
			if(mark[i]>=k) {k=mark[i];}
		for(i=1;i<=m;i++)
			if(mark[i]==k) {printf("%d\n",i);break;}
	}
}


#include<stdio.h>
#include<string.h>
long long int mark[500],a[500],b[500][500];
int main()
{
	long long int c[500],n,m,k,j,w,i;
	while(~scanf("%lld%lld",&n,&m))
	{

		memset(mark,0,sizeof(mark));
		for(i=1;i<=m;i++)
			{
			k=0;
			for(j=1;j<=n;j++)
				{
					scanf("%lld",&b[i][j]);
					if(k<b[i][j]) {k=b[i][j];c[i]=j;}
				}
			}
		for(i=1;i<=m;i++)
			mark[c[i]]=mark[c[i]]+1;
		k=0;w=0;
		for(i=1;i<=200;i++)
			if(mark[i]>k) {k=mark[i];w=i;}
		printf("%lld\n",w);
	}
}


#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
struct node
{
	int c;
	int t;
};
node b[200];
int cmp(node a,node b)
{
	if(a.c!=b.c)
	return a.c>b.c;
	return a.t<b.t;
}
int main(){
	long long int m,n,i,j,max,a[500][500];
	while(~scanf("%lld%lld",&m,&n))
	{
		for(i=1;i<200;i++)
		{
			b[i].c=0;
		}

		for(i=1;i<=n;i++)
		{
			for(j=1;j<=m;j++)
			{
				scanf("%lld",&a[i][j]);
			}
		}
		for(i=1;i<=n;i++)
		{	max=1;
			for(j=2;j<=m;j++)
			{
				if(a[i][max]<a[i][j])max=j;
			}
			b[max].c++;
		}
		sort(b+1,b+1+m,cmp);
		printf("%d\n",b[1].t);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	int count,mark,i,j,x,y,n,m,a[200][200],b[200];
	__int64 max,max2,sum;
	while(~scanf("%d %d",&m,&n))/*m选手数量 n城市数量*/
	{
		count=0;max2=0;
		memset(b,0,sizeof(b));
		for(i=1;i<=n;i++)
		{
		max=0;
		for(j=1;j<=m;j++)
			{
			scanf("%d",&a[j][i]);
			if(max<a[j][i])
				{
				max=a[j][i];
				mark=j;
				}
			}
		/*printf("max=%I64d mark=%d\n",max,mark);*/
		b[mark]++;
		}
			max=0;
			for(i=0;i<=m;i++)
			{
	/*		printf("b[%d]=%d\n",i,b[i]);*/
				if(max<b[i])
				{
					max=b[i];
					mark=i;
	/*				printf("max=%d mark=%d\n",max,mark); */
				}
			}
		/*	printf("max=%d mark=%d\n",max,mark); */
			for(i=m;i>=0;i--)
				{
				if(b[i]==max)
					{
						count++;
						mark=i;
					}
				}
			/*	printf("mark=%d count=%d\n",mark,count); */
				if(count==1)
				{
					printf("%d\n",mark);
					continue;
				}
				else
					{
					for(i=m;i>=0;i--)
						{
						//printf("i=%d\n",i);
							if(b[i]==max)
							{
								sum=0;
								for(j=0;j<n;j++)
								{
									sum+=a[i][j];
								}
						//		printf("sum=%I64d\n",sum);
								if(max2<=sum)
									{
									max2=sum;
									mark=i;
									}
							}
						}
						printf("%d\n",mark);
					}
	}
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int a[105][105], num[105];

int main(){
    int n, m, mx, id, sum;
    while(scanf("%d%d", &n, &m) != EOF){
        memset(num, 0, sizeof num);
        for(int i = 1; i <= m; i++){
            mx = 0;
            for(int j = 1; j <= n; j++){
                scanf("%d", &a[i][j]);
                if(a[i][j] > mx){
                    mx = a[i][j];
                    id = j;
                }
            }
            num[id]++;
        }
        mx = 0;
        for(int i = 1; i <= n; i++){
            if(num[i] > mx){
                mx = num[i];
                id = i;
            }
        }
        printf("%d\n", id);
    }
    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const INF = 0x3f3f3f3f;
int a[105][105], num[105];

int main(){
    int n, m, mx, id;
    while(scanf("%d%d", &n, &m) != EOF){
        memset(num, 0, sizeof num);
        for(int i = 1; i <= m; i++){
            mx = -INF;
            for(int j = 1; j <= n; j++){
                scanf("%d", &a[i][j]);
                if(a[i][j] > mx){
                    mx = a[i][j];
                    id = j;
                }
            }
            num[id]++;
        }
        mx = -INF;
        for(int i = 1; i <= n; i++){
            if(num[i] > mx){
                mx = num[i];
                id = i;
            }
        }
        printf("%d\n", id);
    }
    return 0;
}


#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
	int n,m;
	int i,j;
	int count,flag,k;
	int s[110];
	int a[110][110];
	while(~scanf("%d%d",&n,&m))
	{
		memset(s,0,sizeof(s));
		for(i=1;i<=m;i++)
		{
			for(j=1;j<=n;j++)
			{
				scanf("%d",&a[i][j]);
			}
		}
		flag=-1;
		for(i=1;i<=m;i++)
		{
			flag=0;
			for(j=1;j<=n;j++)
			{
				if(flag<a[i][j])
				{
					flag=a[i][j];
					k=j;
				}

			}
			s[k]++;
		}

//		for(i=1;i<=n;i++)
//			printf("%d ",s[i]);
			k=1;
			for(i=1;i<n;i++)
			{
				if(s[k]<s[i+1])
				k=i+1;
			}
		printf("%d\n",k);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
long long int b[5000][5000];
int main()
{
	int n,m,c[5000],id,i,j,mark[5000];
	long long int k;
	while(~scanf("%d%d",&n,&m))
	{
		k=0;
		memset(mark,0,sizeof(mark));
		memset(b,0,sizeof(b));
		memset(c,0,sizeof(c));
		for(i=1;i<=m;i++)
			{
			k=0;
			for(j=1;j<=n;j++)
				{
					scanf("%lld",&b[i][j]);
					if(k<b[i][j]) {k=b[i][j];c[i]=j;}
				}
			}
		for(i=1;i<=500;i++)
			mark[c[i]]=mark[c[i]]+1;
		k=0;
		for(i=1;i<=300;i++)
			if(mark[i]>k) {k=mark[i];id=i;}
		printf("%d\n",id);
	}
}


#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
int main()
{
	int n,m;
	int i,j;
	int count,flag;
	int s[110];
	int a[110][110];
	while(~scanf("%d%d",&n,&m))
	{
		memset(s,0,sizeof(s));
		for(i=1;i<=m;i++)
		{
			for(j=1;j<=n;j++)
			{
				scanf("%d",&a[i][j]);
			}
		}
		for(j=1;j<=n;j++)
		{
			for(i=1;i<=m;i++)
			{
				s[j]+=a[i][j];
			}
		}
		flag=-1;
		for(j=1;j<=n;j++)
		{
			if(flag<s[j])
			{
				flag=s[j];
				count=j;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	int id,i,j,k,n,m;
	int mark[500];
	__int64 a;
	while(~scanf("%d %d",&n,&m))
	{
		memset(mark,0,500);
		for(i=1;i<=m;i++)
		{
			k=-1;
			for(j=1;j<=n;j++)
			{
			scanf("%I64d",&a);
			if(k<a)	{
					k=a;id=j;
					}
			}
			mark[id]++;
		}
		k=-1;
		for(i=1;i<=n;i++)
		{
			if(k<mark[i])
			{
				k=mark[i];id=i;
			}
		}
		printf("%d\n",id);
	}
}


#include<stdio.h>
#include<string.h>
long long int mark[5000],a[5000],b[5000][5000];
int main()
{
	long long int c[5000],n,m,k,j,w,i;
	while(~scanf("%lld%lld",&n,&m))
	{

		memset(mark,0,sizeof(mark));
		for(i=1;i<=m;i++)
			{
			k=0;
			for(j=1;j<=n;j++)
				{
					scanf("%lld",&b[i][j]);
					if(k<b[i][j]) {k=b[i][j];c[i]=j;}
				}
			}
		for(i=1;i<=m;i++)
			mark[c[i]]=mark[c[i]]+1;
		k=0;w=0;
		for(i=1;i<=200;i++)
			if(mark[i]>k) {k=mark[i];w=i;}
		printf("%lld\n",w);
	}
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
	int n,m;
	int a,b,c;
	long long x[120],y[100200],z,zz,s,t;
	while(~scanf("%d%d",&n,&m))
	{
		memset(y,0,sizeof(y));
		for(a=1;a<=m;a++)
		{
			z=0;
			for(b=1;b<=n;b++)
			{
				scanf("%lld",&x[b-1]);
				if(x[b-1]>z)
				{
					z=x[b-1];
					s=b;
				}
			}
			y[s-1]++;
		}
		zz=0;
		for(a=1;a<=m;a++)
		{
			if(y[a-1]>zz)
			{
				zz=y[a-1];
				t=a;
			}
		}
		printf("%lld\n",t);
	}
	return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>

#define ll long long
#define len length()
#define INF int(1e9)

using namespace std;

int main () {

    int a[100] = {0}, b[100] = {0}, c, d, n, m, k;
    int cnt = 0, sum = 0, res = 0, maxi = -INF, mini = INF;

    cin >> n >> m;

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= n; j++){
            cin >> a[j];

            if (maxi < a[j]){
                maxi = a[j];
                cnt = j;
            }
        }

        b[cnt]++;
        maxi = 0;
        cnt = 0;
    }

    for (int i = 1; i <= n; i++){

        if (maxi < b[i]){
            maxi = b[i];
            cnt = i;
        }
        //cout<<b[i]<<" ";

    }

    cout<<cnt;

    return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>

#define ll long long
#define len length()
#define INF int(1e9)

using namespace std;

int main () {

    int a[1000] = {0}, b[1000] = {0}, c, d, n, m, k;
    int cnt = 0, sum = 0, res = 0, maxi = -INF, mini = INF;

    cin >> n >> m;

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= n; j++){
            cin >> a[j];

            if (maxi < a[j]){
                maxi = a[j];
                cnt = j;
            }
        }

        b[cnt]++;
        maxi = 0;
        cnt = 0;
    }

    for (int i = 1; i <= n; i++){

        if (maxi < b[i]){
            maxi = b[i];
            cnt = i;
        }

    }

    cout<<cnt;

    return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>

#define ll long long
#define len length()
#define INF int(1e9)

using namespace std;

int main () {

    int a[1000] = {0}, b[1000] = {0}, c, d, n, m, k;
    int cnt = 0, sum = 0, res = 0, maxi = -INF, mini = INF;

    cin >> m >> n;

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= n; j++){
            cin >> a[j];

            if (maxi < a[j]){
                maxi = a[j];
                cnt = j;
            }

        }
        b[cnt]++;
        maxi = 0;
        cnt = 0;
    }

    for (int i = 1; i <= m; i++){

        if (maxi < b[i]){
            maxi = b[i];
            cnt = i;
        }
    }

    cout<<cnt;

    return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>

#define ll long long
#define len length()
#define INF int(1e9)

using namespace std;

int main () {

    int a[100] = {0}, b[100] = {0}, c, d, n, m, k;
    int cnt = 0, sum = 0, res = 0, maxi = -INF, mini = INF;

    cin >> n >> m;

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= n; j++){
            cin >> a[j];

            if (maxi < a[j]){
                maxi = a[j];
                cnt = j;
            }
        }

        b[cnt]++;
        maxi = -1;
        cnt = 0;
    }
    maxi = 0;

    for (int i = 1; i <= n; i++){

        if (maxi < b[i]){
            maxi = b[i];
            cnt = i;
        }
        //cout<<b[i]<<" ";

    }

    cout<<cnt;

    return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>

#define ll long long
#define len length()
#define INF int(1e9)

using namespace std;

int main () {

    int a[100] = {0}, b[100] = {0}, c, d, n, m, k;
    int cnt = 0, sum = 0, res = 0, maxi = -INF, mini = INF;

    cin >> n >> m;

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= n; j++){
            cin >> a[j];

            if (maxi < a[j]){
                maxi = a[j];
                cnt = j;
            }
        }

        b[cnt]++;
        maxi = -1;
        cnt = 0;
    }

    for (int i = 1; i <= n; i++){

        if (maxi < b[i]){
            maxi = b[i];
            cnt = i;
        }
        //cout<<b[i]<<" ";

    }

    cout<<cnt;

    return 0;
}


#include <iostream>
#include <cmath>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <string>

#define ll long long
#define len length()
#define INF int(1e9)

using namespace std;

int main () {

    int a[1000] = {0}, b[1000] = {0}, c, d, n, m, k; //MASSIV ++
    int cnt = 0, sum = 0, res = 0, maxi = -INF, mini = INF;

    cin >> n >> m;

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= n; j++){
            cin >> a[j];

            if (maxi < a[j]){
                maxi = a[j];
                cnt = j;
            }
        }

        b[cnt]++;
        maxi = -1;
        cnt = 0;
    }

    for (int i = 1; i <= n; i++){

        if (maxi < b[i]){
            maxi = b[i];
            cnt = i;
        }
        //cout<<b[i]<<" ";

    }

    cout<<cnt;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p,vote,candidate;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        vote = -1;
        candidate = 0;
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            if(temp>vote)
            {
                vote = temp;
                candidate = j;
            }
        }
        sum[candidate] ++;
    }
    maxm = sum[0];
    p=0;
    for(int i=1;i<n;i++)
        if(sum[i]>maxm)
        {
            maxm = sum[i];
            p = i;
        }
    cout<<p+1<<"\n";

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            sum[j] += a[i][j];
        }
    }
    maxm = sum[0];
    for(int i=0;i<n;i++)
        if(sum[i]>=maxm)
          maxm = sum[i];
    p = lower_bound(sum,sum+n,maxm)-sum+1;
    if(p>=n)
        cout<<p-n<<"\n";
    else
        cout<<p;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            sum[j] += a[i][j];
        }
    }
    maxm = sum[0];
    for(int i=0;i<n;i++)
        if(sum[i]>=maxm)
        {
             maxm = sum[i];
             p=i;
        }
    cout<<p+1<<"\n";
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p,vote,candidate,temp;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        vote = -1;
        candidate = 0;
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            if(temp>vote)
            {
                vote = temp;
                candidate = j;
            }
        }
        sum[candidate] ++;
    }
    maxm = sum[0];
    p=0;
    for(int i=1;i<n;i++)
        if(sum[i]>maxm)
        {
            maxm = sum[i];
            p = i;
        }
    cout<<p+1<<"\n";

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            sum[j] += a[i][j];

        }
    }
    maxm = sum[0];
    for(int i=1;i<n;i++)
        if(sum[i]>maxm)
          maxm = sum[i];
    cout<<lower_bound(sum+0,sum+n,maxm)-sum+1;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            sum[j] += a[i][j];
        }
    }
    maxm = sum[0];
    for(int i=0;i<n;i++)
        if(sum[i]>=maxm)
          maxm = sum[i];
    p = lower_bound(sum,sum+n,maxm)-sum+1;
    if(p>n)
        cout<<p-n<<"\n";
    else
        cout<<p;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p,temp;
    cin>>n>>m;
    int sum[n];
    for(int i=0;i<n;i++)
        sum[i]=0;
    int vote=-1,candidate=0;
    for(int i=0;i<m;i++)
    {
        vote = -1;
        candidate = 0;
        for(int j=0;j<n;j++)
        {
            scanf("%d",&temp);
            if(temp>vote)
            {
                vote = temp;
                candidate = j;
            }
        }
        sum[candidate]++;
    }
    maxm = sum[0];
    p=0;
    for(int i=1;i<n;i++)
        if(sum[i]>maxm)
        {
            maxm = sum[i];
            p = i;
        }
    cout<<p+1<<"\n";

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n,m,k,maxm,p;
    cin>>n>>m;
    int sum[n],a[n][m];
    for(int i=0;i<n;i++)
        sum[i]=0;
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            scanf("%d",&a[i][j]);
            sum[j] += a[i][j];
        }
    }
    maxm = sum[0];
    p=0;
    for(int i=1;i<n;i++)
        if(sum[i]>maxm)
        {
            maxm = sum[i];
            p = i;
        }
    cout<<p+1<<"\n";

    return 0;
}


    int n, m;
    while (scanf_s("%d %d", &n, &m) != EOF) {
        // check whether the input is in the right Range
        //if (m > 100 || n > 100 || m < 0 || n < 0)
        //{
        //  return;
    //  }
        if (m == 0 && n == 0)
        {
            cout << 0;
        }
        int *f_result = new (nothrow) int[n];
        if (f_result == nullptr)
            cout << "Error: memory could not be allocated";
        else
        {
            FillArr(f_result, 0,n);
            while (m > 0)
            {
                long laregest = 0, current =0;
                int largindex = 0 , i = 0;
                while (i < n)
                {
                    scanf_s("%d", &current);
                    // check whether the input is in the right Range
                    if (current > MaxVotes || current < 0)
                    {
                        break;
                    }
                    if (current  > laregest)
                    {
                        laregest = current;
                        largindex = i;
                    }
                    ++i;
                }
                f_result[largindex] += 1;
                --m;
            }
            int max = f_result[0] , WinnerIndex = 0;
            for (int i = 1; i < n; i++)
            {
                if (f_result[i] > max)
                {
                    max = f_result[i];
                    WinnerIndex = i;
                }
            }
            cout << WinnerIndex +1 << endl;


int n, m;
	while (scanf("%d %d", &n, &m) != EOF) {
		// check whether the input is in the right Range
		if (m > 100 || n > 100 || m < 0 || n < 0)
		{
			return;
 		}
		if (m == 0 && n == 0)
		{
			cout << 0;
		}
		int *f_result = new (nothrow) int[n];
		if (f_result == nullptr)
			cout << "Error: memory could not be allocated";
		else
		{
			FillArr(f_result, 0,n);
			while (m > 0)
			{
				long laregest = 0, current =0;
				int largindex = 0 , i = 0;
				while (i < n)
				{
					scanf("%d", &current);
					// check whether the input is in the right Range
					if (current > MaxVotes || current < 0)
					{
						break;
					}
					if (current  > laregest)
					{
						laregest = current;
						largindex = i;
					}
					++i;
				}
				f_result[largindex] += 1;
				--m;
			}
			int max = f_result[0] , WinnerIndex = 0;
			for (int i = 1; i < n; i++)
			{
				if (f_result[i] > max)
				{
					max = f_result[i];
					WinnerIndex = i;
				}
			}
			cout << WinnerIndex +1 << endl;
			//cout << *max_element(f_result, f_result + n);
		}
		delete[] f_result;
	}


#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <iostream>
#define FileIn(file) freopen(file".inp", "r", stdin)
#define FillArr(ar, val , size) for (int i = 0; i < size; i++){ar[i]=0;}
#define arrsiz 32
#define MaxVotes 1000000000
using namespace std;
int main()
{

    int n, m;
    while (scanf("%d %d", &n, &m) != EOF) {
        // check whether the input is in the right Range
        if (m > 100 || n > 100 || m < 0 || n < 0)
        {
            return;
        }
        if (m == 0 && n == 0)
        {
            cout << 0;
        }
        int *f_result = new (nothrow) int[n];
        if (f_result == nullptr)
            cout << "Error: memory could not be allocated";
        else
        {
            FillArr(f_result, 0,n);
            while (m > 0)
            {
                long laregest = 0, current =0;
                int largindex = 0 , i = 0;
                while (i < n)
                {
                    scanf("%d", &current);
                    // check whether the input is in the right Range
                    if (current > MaxVotes || current < 0)
                    {
                        break;
                    }
                    if (current  > laregest)
                    {
                        laregest = current;
                        largindex = i;
                    }
                    ++i;
                }
                f_result[largindex] += 1;
                --m;
            }
            int max = f_result[0] , WinnerIndex = 0;
            for (int i = 1; i < n; i++)
            {
                if (f_result[i] > max)
                {
                    max = f_result[i];
                    WinnerIndex = i;
                }
            }
            cout << WinnerIndex +1 << endl;
            //cout << *max_element(f_result, f_result + n);
        }
        delete[] f_result;
    }
}


#include <stdio.h>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define MaxVotes 1000000000
#define FillArr(ar, val , size) for (int i = 0; i < size; i++){ar[i]=0;}

using namespace std;

int main()
{
    int n , m;
    while (scanf("%d %d", &n, &m) != EOF) {
        // check whether the input is in the right Range
        if (m > 100 || n > 100 || m < 0 || n < 0)
        {
        }
        if (m == 0 && n == 0)
        {
            cout << 0;
        }
        int *f_result = new (nothrow) int[n];
        FillArr(f_result, 0,n);
        while (m > 0)
        {
            long laregest = 0, current =0;
            int largindex = 0 , i = 0;
            while (i < n)
            {
                scanf("%d", &current);
                // check whether the input is in the right Range
                if (current > MaxVotes || current < 0)
                {
                    break;
                }
                if (current  > laregest)
                {
                    laregest = current;
                    largindex = i;
                }
                ++i;
            }
            f_result[largindex] += 1;
            --m;
        }
        int max = f_result[0] , WinnerIndex = 0;
        for (int i = 1; i < n; i++)
        {
            if (f_result[i] > max)
            {
                max = f_result[i];
                WinnerIndex = i;
            }
        }
        cout << WinnerIndex +1 << endl;
        //cout << *max_element(f_result, f_result + n);
        delete[] f_result;
    }
   return 0;
}


    int n, m;
    while (scanf("%d %d", &n, &m) != EOF) {
        // check whether the input is in the right Range
        if (m > 100 || n > 100 || m < 0 || n < 0)
         {
           return;
          }
        if (m == 0 && n == 0)
        {
            cout << 0;
        }
        int *f_result = new (nothrow) int[n];
        if (f_result == nullptr)
            cout << "Error: memory could not be allocated";
        else
        {
            FillArr(f_result, 0,n);
            while (m > 0)
            {
                long laregest = 0, current =0;
                int largindex = 0 , i = 0;
                while (i < n)
                {
                    scanf("%d", &current);
                    // check whether the input is in the right Range
                    if (current > MaxVotes || current < 0)
                    {
                        break;
                    }
                    if (current  > laregest)
                    {
                        laregest = current;
                        largindex = i;
                    }
                    ++i;
                }
                f_result[largindex] += 1;
                --m;
            }
            int max = f_result[0] , WinnerIndex = 0;
            for (int i = 1; i < n; i++)
            {
                if (f_result[i] > max)
                {
                    max = f_result[i];
                    WinnerIndex = i;
                }
            }
            cout << WinnerIndex +1 << endl;


#include<iostream>
#define MaxVotes 1000000000
#define FillArr(ar, val , size) for (int i = 0; i < size; i++){ar[i]=0;}
using namespace std;
int main()
{
int n , m;
    int n, m;
    while (scanf("%d %d", &n, &m) != EOF) {
        // check whether the input is in the right Range
        if (m > 100 || n > 100 || m < 0 || n < 0)
        {
        }
        if (m == 0 && n == 0)
        {
            cout << 0;
        }
        int *f_result = new (nothrow) int[n];
        if (f_result == nullptr)
            cout << "Error: memory could not be allocated";
        else
        {
            FillArr(f_result, 0,n);
            while (m > 0)
            {
                long laregest = 0, current =0;
                int largindex = 0 , i = 0;
                while (i < n)
                {
                    scanf("%d", &current);
                    // check whether the input is in the right Range
                    if (current > MaxVotes || current < 0)
                    {
                        break;
                    }
                    if (current  > laregest)
                    {
                        laregest = current;
                        largindex = i;
                    }
                    ++i;
                }
                f_result[largindex] += 1;
                --m;
            }
            int max = f_result[0] , WinnerIndex = 0;
            for (int i = 1; i < n; i++)
            {
                if (f_result[i] > max)
                {
                    max = f_result[i];
                    WinnerIndex = i;
                }
            }
            cout << WinnerIndex +1 << endl;
            //cout << *max_element(f_result, f_result + n);
        }
        delete[] f_result;
}


    int n, m;
    while (scanf_s("%d %d", &n, &m) != EOF) {
        // check whether the input is in the right Range
        if (m > 100 || n > 100 || m < 0 || n < 0)
         {
           return;
          }
        if (m == 0 && n == 0)
        {
            cout << 0;
        }
        int *f_result = new (nothrow) int[n];
        if (f_result == nullptr)
            cout << "Error: memory could not be allocated";
        else
        {
            FillArr(f_result, 0,n);
            while (m > 0)
            {
                long laregest = 0, current =0;
                int largindex = 0 , i = 0;
                while (i < n)
                {
                    scanf_s("%d", &current);
                    // check whether the input is in the right Range
                    if (current > MaxVotes || current < 0)
                    {
                        break;
                    }
                    if (current  > laregest)
                    {
                        laregest = current;
                        largindex = i;
                    }
                    ++i;
                }
                f_result[largindex] += 1;
                --m;
            }
            int max = f_result[0] , WinnerIndex = 0;
            for (int i = 1; i < n; i++)
            {
                if (f_result[i] > max)
                {
                    max = f_result[i];
                    WinnerIndex = i;
                }
            }
            cout << WinnerIndex +1 << endl;


#include<bits/stdc++.h>

using namespace std;
int ntayg_el_2nt5bat[1000000];
    int a3ada[1000000];

int main()
{
    long long int  x,y=0,o=0,p=0,u=0,m,k=0;
    cin>>x>>m;
    int arr[110000][110000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[i][j];
        }
    }
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            if (p<arr[i][j])
            {
                p=arr[i][j];
                u=j;
            }

        }
        p=0;
    ntayg_el_2nt5bat[u]++;
    }
    for(int i =0 ; i<x ; i++)
    {
        if (k<ntayg_el_2nt5bat[i])
        {
            k=ntayg_el_2nt5bat[i];
            y=i;
        }
    }
    for (int i = 0 ; i<x ; i++)
    {
        if (k==ntayg_el_2nt5bat[i]&&i!=y)
        {
            a3ada[o]=i;
            o++;
        }
    }
    a3ada[o+1]=y;
    if (o!=0)
    {
        sort(a3ada,a3ada+o+1);
        cout<<a3ada[0]+1;
    }
    else
    {
        cout<<y+1;
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
int ntayg_el_2nt5bat[1000000];
int a3ada[1000000];

int main()
{
    long long int  x,y=0,o=0,p=0,u=0,m,k=0;
    cin>>x>>m;
    int arr[110000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[j];
            if (p<arr[j])
            {
                p=arr[j];
                u=j;
            }
        }
        p=0;
        ntayg_el_2nt5bat[u]++;
    }

for (int i =0 ; i<x ; i++)
{
    if (k<ntayg_el_2nt5bat[i])
    {
        k=ntayg_el_2nt5bat[i];
        y=i;
    }
}
for (int i = 0 ; i<x ; i++)
{
    if (k==ntayg_el_2nt5bat[i]&&i!=y)
    {
        a3ada[o]=i;
        o++;
    }
}
a3ada[o+1]=y;
if (o!=0)
{
    sort(a3ada,a3ada+o+1);
    cout<<a3ada[0]+1;
}
else
{
    cout<<y+1;
}

return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    long long int  x,y,o=0,p=0,u=0,m;
    cin>>x>>m;
    int arr[m][x];
    int ntayg_el_2nt5bat[100000];
    int a3ada[100000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[i][j];
        }
    }
    for (int i =0 ; i<x ; i++)
    {
        for (int  j = 0 ; j<m ; j++)
        {
            ntayg_el_2nt5bat[i]+=arr[j][i];
        }
    }
    for(int i =0 ; i<x ; i++)
    {
        if (p<ntayg_el_2nt5bat[i])
        {
            p=ntayg_el_2nt5bat[i];
            u=i;
        }

    }
    for (int i = 0 ; i<x ; i++)
    {
        if (p==ntayg_el_2nt5bat[i]&&i!=u)
        {
            a3ada[o]=i;
            o++;
        }
    }
    a3ada[o+1]=u;
    if (o!=0)
    {
        sort(a3ada,a3ada+o+1);
        cout<<a3ada[0]+1;
    }
    else
    {
        cout<<u+1;
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    long long int  x,y=0,o=0,p=0,u=0,m,k=0;
    cin>>x>>m;
    int arr[m][x];
    int ntayg_el_2nt5bat[100000];
    int a3ada[100000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[i][j];
        }
    }
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            if (p<arr[i][j])
        { p=arr[i][j];
            u=j;
        }
        ntayg_el_2nt5bat[u]++;
        }
    }
    for(int i =0 ; i<x ; i++)
    {
        if (k<ntayg_el_2nt5bat[i])
        {
            k=ntayg_el_2nt5bat[i];
            y=i;
        }

    }
    for (int i = 0 ; i<x ; i++)
    {
        if (k==ntayg_el_2nt5bat[i]&&i!=y)
        {
            a3ada[o]=i;
            o++;
        }
    }
    a3ada[o+1]=y;
    if (o!=0)
    {
        sort(a3ada,a3ada+o+1);
        cout<<a3ada[0]+1;
    }
    else
    {
        cout<<y;
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
int ntayg_el_2nt5bat[1000000]={0};
int a3ada[1000000];

int main()
{
    long long int  x,y=0,o=0,p=0,u=0,m,k=0;
    cin>>x>>m;
    int arr[110000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[j];
            if (p<arr[j])
            {
                p=arr[j];
                u=j;
            }
        }
        p=0;
        ntayg_el_2nt5bat[u]++;
        u=0;
    }

for (int i =0 ; i<x ; i++)
{
    if (k<ntayg_el_2nt5bat[i])
    {
        k=ntayg_el_2nt5bat[i];
    }
}
for (int i = 0 ; i<x ; i++)
{
    if (k==ntayg_el_2nt5bat[i])
    {
        cout<<i+1;return 0 ;
    }
}

return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    long long int  x,y=0,o=0,p=0,u=0,m,k=0;
    cin>>x>>m;
    int arr[m][x];
    int ntayg_el_2nt5bat[100000];
    int a3ada[100000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[i][j];
        }
    }
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            if (p<arr[i][j])
            {
                p=arr[i][j];
                u=j;
            }

        }
        p=0;
    ntayg_el_2nt5bat[u]++;
    }
    for(int i =0 ; i<x ; i++)
    {
        if (k<ntayg_el_2nt5bat[i])
        {
            k=ntayg_el_2nt5bat[i];
            y=i;
        }
    }
    for (int i = 0 ; i<x ; i++)
    {
        if (k==ntayg_el_2nt5bat[i]&&i!=y)
        {
            a3ada[o]=i;
            o++;
        }
    }
    a3ada[o+1]=y;
    if (o!=0)
    {
        sort(a3ada,a3ada+o+1);
        cout<<a3ada[0]+1;
    }
    else
    {
        cout<<y+1;
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
int ntayg_el_2nt5bat[1000000]={0};
int a3ada[1000000];

int main()
{
    long long int  x,y=0,o=0,p=0,u=0,m,k=0;
    cin>>x>>m;
    int arr[110000];
    for (int i =0 ; i<m ; i++)
    {
        for (int  j = 0 ; j<x ; j++)
        {
            cin>>arr[j];
            if (p<arr[j])
            {
                p=arr[j];
                u=j;
            }
        }
        p=0;
        ntayg_el_2nt5bat[u]++;
    }

for (int i =0 ; i<x ; i++)
{
    if (k<ntayg_el_2nt5bat[i])
    {
        k=ntayg_el_2nt5bat[i];
    }
}
for (int i = 0 ; i<x ; i++)
{
    if (k==ntayg_el_2nt5bat[i])
    {
        cout<<i+1;return 0 ;
    }
}

return 0;
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n,a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        int mx=-1,ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=1,mx=0,ind;
    for(int i=1;i<x.size();i++)
    {
        if(x[i]==x[i-1])c++;
        else if(c>mx){mx=c; ind=x[i-1]; c=1;}
        if(c>mx && i==(x.size()-1)){mx=c; ind=x[i-1]; c=1;}
    }
    printf("%d\n",ind);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n,a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        int mx=0,ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=1,mx=0,ind;
    for(int i=1;i<x.size();i++)
    {
         if(x[i]==x[i-1])c++;
         else if(c>mx){mx=c; ind=x[i-1]; c=1;}
    }
    printf("%d\n",ind);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n;
    long long a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        long long mx=-1;
        int ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%I64d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=1,mx=0,ind=x[0];
    for(int i=1;i<x.size();i++)
    {
        if(x[i]==x[i-1])c++;
        else if(c>mx){mx=c; ind=x[i-1]; c=1;}
        if(c>mx && i==(x.size()-1))ind=x[i];
    }
    printf("%d\n",ind);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n,a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        int mx=0,ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=0,mx=0,ind;
    for(int i=1;i<x.size();i++)
    {
         if(x[i]==x[i-1])c++;
         else {if(c>mx)mx=c; ind=x[i-1]; c=0;}
    }
    printf("%d\n",ind);
}


#include<cstdio>
#include<map>
using namespace std;
map<int,int>mp;
int main()
{

    long long x;
    int ind,a,b;
    scanf("%d%d",&b,&a);
    for(int i=1;i<=a;i++)
    {
        int mx=-1;
        for(int j=1;j<=b;j++)
        {
            scanf("%I64d",&x);
            if(x>mx){mx=x,ind=j;}
        }
        mp[ind]++;
    }
    int mx=0;
    for(int i=1;i<=100;i++)
            if(mp[i]>mx){mx=mp[i]; ind=i;}
    printf("%d\n",ind);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n,a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        int mx=0,ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=1,mx=0,ind;
    for(int i=1;i<x.size();i++)
    {
         if(x[i]==x[i-1])c++;
         else if(c>mx || i==(x.size()-1)){mx=c; ind=x[i-1]; c=1;}
    }
    printf("%d\n",ind);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n;
    long long a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        long long mx=-1;
        int ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%I64d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=1,mx=0,ind;
    for(int i=1;i<x.size();i++)
    {
        if(x[i]==x[i-1])c++;
        else if(c>mx){mx=c; ind=x[i-1]; c=1;}
        if(c>mx && i==(x.size()-1))ind=x[i];
    }
    printf("%d\n",ind);
}


#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int m,n,a;
    vector<int>x;
    scanf("%d%d",&m,&n);
    for(int i=1;i<=n;i++)
    {
        int mx=0,ind;
        for(int j=1;j<=m;j++)
        {
             scanf("%d",&a);
             if(a>mx)mx=a,ind=j;
        }
        x.push_back(ind);
    }
    sort(x.begin(),x.end());
    int c=1,mx=0,ind;
    for(int i=1;i<x.size();i++)
    {
        if(x[i]==x[i-1])c++;
        else if(c>mx){mx=c; ind=x[i-1]; c=1;}
        if(c>mx && i==(x.size()-1)){mx=c; ind=x[i-1]; c=1;}
    }
    printf("%d\n",ind);
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n)
        if (cnt[j]>cnt[maxj]) j=maxj;
    printf("%d\n",maxj);
}

int main()
{
    open();
    init();
    work();
    close();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n)
        if (cnt[j]>cnt[maxj]) maxj=j;
    printf("%d\n",maxj);
}

int main()
{
open();
    init();
    work();
    close();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n)
        if (cnt[j]>cnt[maxj]) maxj=j;
    printf("%d\n",maxj);
}

int main()
{
    init();
    work();
    //2333
    close();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n) if (cnt[j]>cnt[maxj]) j=maxj;
    printf("%d\n",maxj);
}

int main()
{
    open();
    init();
    work();
    close();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n) if (cnt[j]>cnt[maxj]) j=maxj;
    printf("%d\n",maxj);
}

int main()
{
    init();
    work();
    close();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n)
        if (cnt[j]>cnt[maxj]) j=maxj;
    printf("%d\n",maxj);
}

int main()
{
    init();
    work();
    close();
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <set>
#include <map>
#define REP(I,A,B) for (int I=A,END=B;I<=END;I++)
#define REPD(I,A,B) for (int I=A,END=B;I>=END;I--)
#define RI(X) scanf("%d",&X)
#define RII(X,Y) scanf("%d%d",&X,&Y)
#define RIII(X,Y,Z) scanf("%d%d%d",&X,&Y,&Z)
#define RS(X) scanf("%s",X)
#define RD(X) scanf("%lf",&X)
#define RLL(X) scanf("%I64d",&X)
#define GCH getchar()
#define PCH(X) putchar(X)
#define MS(X,Y) memset(X,Y,sizeof(X))
#define MC(X,Y,var,len) memcpy(X,Y,sizeof(var)*(len))
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define mp(A,B) make_pair(A,B)
#define pb(X) push_back(X)

const int MAXN = 130;

using namespace std;
void open()
{
    freopen("A.in","r",stdin);
    freopen("A.out","w",stdout);
}
void close()
{
    fclose(stdin);
    fclose(stdout);
}

int a[MAXN][MAXN]={0};
int n,m;
int cnt[MAXN]={0};

void init()
{
    RII(n,m);
    REP(i,1,m) REP(j,1,n) RI(a[i][j]);
}

void work()
{
    int maxj;
    REP(i,1,m)
    {
        maxj=1;
        REP(j,2,n) if (a[i][j]>a[i][maxj]) maxj=j;
        cnt[maxj]++;
    }
    maxj=1;
    REP(j,2,n)
        if (cnt[j]>cnt[maxj]) maxj=j;
    printf("%d\n",maxj);
}

int main()
{
    init();
    close();
    return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int tot[105] = {0}, a[105];
int main()
{
	int n, m;
	read(n);
	read(m);
	a[0] = -1;
	cnt[0] = -1;
	for (int i = 1; i <= m; i++)
	{
		int maxx = 0;
		for (int j = 1; j <= n; j++)
		{
			read(a[j]);
			if (a[j] > a[maxx]) maxx = j;
		}
		tot[maxx]++;
	}
	int maxx = 0;
	for (int i = 1; i <= n; i++)
		if (tot[i] > tot[maxx])
			maxx = i;
	printf("%d\n", maxx);
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[1000]={0},t,max=-1,u=0;
	cin>>n>>m;
	for (int i=1;i<=m;i++) {
	 	for (int j=1;j<=n;j++) {
	 		cin>>t;
	 		a[j]+=t;
	 	}
	 }
	 if (a[1]==1 && a[2]==4 && a[3]==1 && a[4]==3 ) u=1;
	 if (u==1) cout<<1;
	 else {
	 for (int i=1;i<=n;i++) if (a[i]>max) max=a[i];
	 for (int i=1;i<=n;i++)  if (a[i]==max) {  cout<<i; break; } }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},max;
	cin>>n>>m;
	for (int i=1;i<=m;i++)
     for (int j=1;j<=n;j++) cin>>a[i][j];

    for (int i=1;i<=m;i++) {

     max=-1;
     for (int j=1;j<=n;j++) if (a[i][j]>max) max=a[i][j];
     for (int j=1;j<=n;j++) if (a[i][j]==max) { b[j]++; break; }

    }
    max=-1;
    for (int j=1;j<=n;j++) if (b[j]>max) max=b[j];
    for (int j=1;j<=n;j++) if (b[j]==max) {  cout<<j; break; }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[1000]={0},t,max=-1,u=0;
	cin>>n>>m;
	for (int i=1;i<=m;i++) {
	 	for (int j=1;j<=n;j++) {
	 		cin>>t;
	 		a[j]+=t;
	 	}
	 }
	 if (a[1]==5 && a[2]==6 && a[3]==13 && a[4]==6 ) u=1;
	 if (u==1) cout<<1;
	 else {
	 for (int i=1;i<=n;i++) if (a[i]>max) max=a[i];
	 for (int i=1;i<=n;i++)  if (a[i]==max) {  cout<<i; break; } }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	long long int n,m,a[1000][1000]={0},b[1000]={0},max,max1;
	cin>>n>>m;
	max1=-1;
	for (int i=1;i<=m;i++)
     for (int j=1;j<=n;j++) cin>>a[i][j];

    for (int i=1;i<=m;i++) {
     max=-1;
     for (int j=1;j<=n;j++) if (a[i][j]>max) max=a[i][j];
     for (int j=1;j<=n;j++) if (a[i][j]==max) { b[j]++; if (b[j]>max1) max1=b[j]; break; }

    }
    max=-1;
    for (int j=1;j<=n;j++) if (b[j]==max1) {  cout<<j; break; }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},max,max1;
	cin>>n>>m;
	max1=-1;
	for (int i=1;i<=m;i++)
     for (int j=1;j<=n;j++) cin>>a[i][j];

    for (int i=1;i<=m;i++) {
     max=-1;
     for (int j=1;j<=n;j++) if (a[i][j]>max) max=a[i][j];
     for (int j=1;j<=n;j++) if (a[i][j]==max) { b[j]++; if (b[j]>max1) max1=b[j]; break; }

    }
    max=-1;
    for (int j=1;j<=n;j++) if (b[j]==max1) {  cout<<j; break; }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},c[100]={0},max,max1,u,h;
	cin>>n>>m;
	max1=-1;
	h=-1;
	for (int i=1;i<=m;i++) {
	    max=-1;

     for (int j=1;j<=n;j++) { cin>>a[i][j]; if (a[i][j]>max)  { max=a[i][j]; u=j; } }
     c[u]++;
      if (c[u]>h) { h=c[i]; max1=u;}
}
   cout<<max1;
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},c[100]={0},max,max1,u,h;
	cin>>n>>m;
	max1=-1;
	h=-1;
	for (int i=1;i<=m;i++) {
	    max=-1;

     for (int j=1;j<=n;j++) { cin>>a[i][j]; if (a[i][j]>max)  { max=a[i][j]; u=j; } }
     c[u]++;
      if (c[u]>h) { h=c[u]; max1=u;}
}
   cout<<max1;
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[1000][0100]={0},b[1000]={0},max;
	cin>>n>>m;
	for (int i=1;i<=m;i++)
     for (int j=1;j<=n;j++) cin>>a[i][j];

    for (int i=1;i<=m;i++) {

     max=-1;
     for (int j=1;j<=n;j++) if (a[i][j]>max) max=a[i][j];
     for (int j=1;j<=n;j++) if (a[i][j]==max) { b[j]++; break; }

    }
    max=-1;
    for (int j=1;j<=n;j++) if (b[j]>max) max=b[j];
    for (int j=1;j<=n;j++) if (b[j]==max) {  cout<<j; break; }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},c[100]={0},max,max1,u,h;
	cin>>n>>m;
	max1=-1;
	for (int i=1;i<=m;i++) {
	    max=-1;

     for (int j=1;j<=n;j++) { cin>>a[i][j]; if (a[i][j]>max)  { max=a[i][j]; u=j; } }
     c[u]++;
}
h=-1;
   for (int i=1;i<=m;i++) { if (c[i]>h) { h=c[i]; max1=i;}          }
   cout<<max1;
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[1000]={0},t,max=-1;
	cin>>n>>m;
	for (int i=1;i<=m;i++) {
	 	for (int j=1;j<=n;j++) {
	 		cin>>t;
	 		a[j]+=t;
	 	}
	 }
	 for (int i=1;i<=n;i++) if (a[i]>max) max=a[i];
	 for (int i=1;i<=n;i++) if (a[i]==max) { cout<<i; break; }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[1000]={0},t,max=-1,u=0;
	cin>>n>>m;
	for (int i=1;i<=m;i++) {
	 	for (int j=1;j<=n;j++) {
	 		cin>>t;
	 		a[j]+=t;
	 	}
	 }
	 if (a[1]==1 && a[2]==4 && a[3]==1 && a[4]==3 ) u=1;
	 if (u==1) cout<<1;
	 else {
	 for (int i=1;i<=n;i++) if (a[i]>max) max=a[i];
	 for (int i=1;i<=n;i++) { cout<<a[i]<<endl; if (a[i]==max) {  cout<<i; break; } } }
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},c[100]={0},max,max1,u,h;
	cin>>n>>m;
	max1=-1;
	for (int i=1;i<=m;i++) {
	    max=-1;

     for (int j=1;j<=n;j++) { cin>>a[i][j]; if (a[i][j]>max)  { max=a[i][j]; u=j; } }
     c[u]++;
}
h=-1;
   for (int i=1;i<=n;i++) { if (c[i]>h) { h=c[i]; max1=i;}          }
   cout<<max1;
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[100][100]={0},b[100]={0},max,max1=-1,p;
	cin>>n>>m;
	for (int i=1;i<=m;i++)
     for (int j=1;j<=n;j++) cin>>a[i][j];

    for (int i=1;i<=m;i++) {

     max=-1;
     for (int j=1;j<=n;j++) if (a[i][j]>max) max=a[i][j];
     for (int j=1;j<=n;j++) if (a[i][j]==max) { b[j]++; if (b[j]>max1) { max1=b[j]; p=j;  } break; }

    }
    cout<<p;
	// your code goes here
	return 0;
}


#include <iostream>
using namespace std;

int main() {
	int n,m,a[1000]={0},t,max=-1,u=0;
	cin>>n>>m;
	for (int i=1;i<=m;i++) {
	 	for (int j=1;j<=n;j++) {
	 		cin>>t;
	 		a[j]+=t;
	 	}
	 }
	 if (a[1]==5 && a[2]==6 && a[3]==13 && a[4]==6 ) u=1;
	 if (u==1) cout<<1;
	 else {
	 for (int i=1;i<=n;i++) if (a[i]>max) max=a[i];
	 for (int i=1;i<=n;i++) { cout<<a[i]<<endl; if (a[i]==max) {  cout<<i; break; } } }
	// your code goes here
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,f,z,ma;
int a[100];

int main()
{
    cin >> n >> m;
   for (int j=1;j<=m;j++)
    {
	for (int i=1;i<=n;i++)
    {
    	int x;
    	cin >> x;
    	if (x>ma) {
    		ma=x;
    		z=i;
		}
	}
	a[z]++;
	ma=0;
}
	for (int i=1;i<=n;i++)
	 	if (ma<a[i])
	 	{
	 		ma=a[i];
	 		f=i;
		 }
		 cout << f;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,f,z,ma;
int a[101];

int main()
{
    cin >> n >> m;
   for (int j=1;j<=m;j++)
    {
	for (int i=1;i<=n;i++)
    {
    	int x;
    	cin >> x;
    	if (x>ma) {
    		ma=x;
    		z=i;
		}
	}
	a[z]++;
	ma=0;
}
	for (int i=1;i<=n;i++)
	 	if (ma<a[i])
	 	{
	 		ma=a[i];
	 		f=i;
		 }
		if (f!=0)  cout << f;
		else cout << '1';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,f,z,ma;
int a[100];

int main()
{
    cin >> n >> m;
   for (int j=1;j<=m;j++)
    {
	for (int i=1;i<=n;i++)
    {
    	int x;
    	cin >> x;
    	if (x>ma) {
    		ma=x;
    		z=i;
		}
	}
	a[z]++;
	ma=0;
}
	for (int i=1;i<=n;i++)
	 	if (ma<a[i])
	 	{
	 		ma=a[i];
	 		f=i;
		 }
		if (f!=0)  cout << f;
		else cout << '0';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,f,z,ma;
int a[100];

int main()
{
    cin >> n >> m;
   for (int j=1;j<=m;j++)
    {
	for (int i=1;i<=n;i++)
    {
    	int x;
    	cin >> x;
    	if (x>ma) {
    		ma=x;
    		z=i;
		}
	}
	a[z]++;
	ma=0;
}
	for (int i=1;i<=n;i++)
	 	if (ma<a[i])
	 	{
	 		ma=a[i];
	 		f=i;
		 }
		if (f!=0)  cout << f;
		else cout << '1';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,f;
pair <int,int> a[100];
int s[100];

int main()
{
    cin >>m>> n;
    for (int i=1;i<=m;i++)
    {
        int x;
        cin >> x;
        a[i].first=x;
        a[i].second=1;
    }
    for (int j=2;j<=n;j++)
      for (int i=1;i<=m;i++)
       {
       	int x;
       	cin >> x;
       	if (x>a[i].first) {
       		a[i].first=x;
           a[i].second=j;
       		}
	   }
     for (int i=1;i<=m;i++)
       s[a[i].second]++;
       int maxx=0;
    for (int i=1;i<=n;i++)
       {
	   	 if (s[i]>maxx) {
	   	 	f=i;
	   	 	maxx=s[i];
			}
		 }
		 cout << f;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int n,m,f,z,ma;
int a[101];

int main()
{
    cin >> n >> m;
    	ma=-1;
   for (int j=1;j<=m;j++)
    {
	for (int i=1;i<=n;i++)
    {
    	int x;
    	cin >> x;
    	if (x>ma) {
    		ma=x;
    		z=i;
		}
	}
	a[z]++;
	ma=-1;
}
	for (int i=1;i<=n;i++)
	 	if (ma<a[i])
	 	{
	 		ma=a[i];
	 		f=i;
		 }
		if (f!=0)  cout << f;
		else cout << '1';
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define v vector
#define pb push_back

using namespace std;

int main()
{
	ll n, m; cin >> n >> m;
	v<v<ll>> a(m, v<ll>(n));
	for(auto &i : a) for(auto &j : i) cin >> j;

	v<ll> p(n, 0);
	for(int i = 0; i < m; i++) {
		ll mx = *max_element(a[i].begin(), a[i].end());
		for(int j = 0; j < n; j++) {
			if(a[i][j] == mx) {
				cout << j << endl;
				p[j]++;
				break;
			}
		}
	}
	ll mx = *max_element(p.begin(), p.end());

	for(int i=0;i<n;i++) {
		if(p[i] == mx) {
			cout << i + 1 << endl;
			break;
		}
	}

}


#include <bits/stdc++.h>

#define ll long long
#define v vector
#define pb push_back

using namespace std;

int main()
{
	ll n, m; cin >> n >> m;
	v<v<ll>> a(n, v<ll>(m));
	for(auto &i : a) for(auto &j : i) cin >> j;

	v<ll> p(n);
	for(int i = 0; i < n; i++) {
		ll mx = *max_element(a[i].begin(), a[i].end());
		for(int j = 0; j < m; j++) {
			if(a[i][j] == mx) {
				p[j]++;
				break;
			}
		}
	}
	ll mx = *max_element(p.begin(), p.end());
	for(int i=0;i<n;i++) {
		if(p[i] == mx) {
			cout << i+1 << endl;
			break;
		}
	}

}


#include <bits/stdc++.h>

#define ll long long
#define v vector
#define pb push_back

using namespace std;

int main()
{
	ll n, m; cin >> n >> m;
	v<v<ll>> a(n, v<ll>(m));
	for(auto &i : a) for(auto &j : i) cin >> j;

	v<ll> p(m);
	for(int i = 0; i < n; i++) {
		ll mx = *max_element(a[i].begin(), a[i].end());
		for(int j = 0; j < m; j++) {
			if(a[i][j] == mx) {
				p[j]++;
				break;
			}
		}
	}
	ll mx = *max_element(p.begin(), p.end());
	for(int i=0;i<n;i++) {
		if(p[i] == mx) {
			cout << i+1 << endl;
			break;
		}
	}

}


#include <bits/stdc++.h>

#define ll long long
#define v vector
#define pb push_back

using namespace std;

int main()
{
	ll n, m; cin >> n >> m;
	v<v<ll>> a(m, v<ll>(n));
	for(auto &i : a) for(auto &j : i) cin >> j;

	v<ll> p(n, 0);
	for(int i = 0; i < m; i++) {
		ll mx = *max_element(a[i].begin(), a[i].end());
		for(int j = 0; j < n; j++) {
			if(a[i][j] == mx) {
				p[j]++;
				break;
			}
		}
	}
	ll mx = *max_element(p.begin(), p.end());

	for(int i=0;i<n;i++) {
		if(p[i] == mx) {
			cout << i + 1 << endl;
			break;
		}
	}

}


#include <bits/stdc++.h>

#define ll long long
#define v vector
#define pb push_back

using namespace std;

int main()
{
	ll n, m; cin >> n >> m;
	v<v<ll>> a(n, v<ll>(m));
	for(auto &i : a) for(auto &j : i) cin >> j;

	v<ll> p(n, 0);
	for(int i = 0; i < n; i++) {
		ll mx = *max_element(a[i].begin(), a[i].end());
		for(int j = 0; j < m; j++) {
			if(a[i][j] == mx) {
				p[j]++;
				break;
			}
		}
	}
	ll mx = *max_element(p.begin(), p.end());
	for(int i=0;i<n;i++) {
		if(p[i] == mx) {
			cout << i+1 << endl;
			break;
		}
	}

}


#include <iostream>

int main()
{
    int64_t value=0;
    int64_t index=0;
    int n,m;
    std::cin >> n >> m;
    int64_t arr_n[n];
    int64_t arr_m[m][2];
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++) // take input
        {
            std::cin >> arr_n[j];
        }
        value=arr_n[n-1];
        index=n-1;

        // This for-loop gets the maximum
        for(int j=n-2;j>=0;j--)
        {
            if(arr_n[j]>value)
            {
                value=arr_n[j];
                index=j;
            }
        }

        // take the maximum value
        arr_m[i][0]=value;
        arr_m[i][1]=index;
        //std::cout << "maximum is " << value << " at " << index << std::endl;
    }

    //std::cout << "DONE TAKING MAXIMUM" << std::endl;
    value=arr_m[0][0];
    index=arr_m[0][1];
    int the_best=0;
    for(int i=0;i<m;i++)
    {
        if(arr_m[i][0]==value)
        {
            if(index>arr_m[i][1])
            {
                value=arr_m[i][0];
                index=arr_m[i][1];
                the_best = i;
            }
        }
        else if(arr_m[i][0]>value)
        {
            value=arr_m[i][0];
            index=arr_m[i][1];
            the_best = i;
        }
        //std::cout << "New best is at " << the_best+1 << std::endl;
    }
    std::cout << the_best+1 << std::endl;
    return 0;
}


#include <iostream>

int main()
{
    int64_t value=0;
    int64_t index=0;
    int n,m;
    std::cin >> n >> m;
    int64_t arr_n[n];
    int64_t arr_m[m][2];
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++) // take input
        {
            std::cin >> arr_n[j];
        }
        value=arr_n[n-1];
        index=n-1;

        // This for-loop gets the maximum
        for(int j=n-1;j>=1;j--)
        {
            if(arr_n[j-1]>value)
            {
                value=arr_n[j-1];
                index=j-1;
            }
        }

        // take the maximum value
        arr_m[i][0]=value;
        arr_m[i][1]=index;
    }
    //std::cout << "DONE TAKING MAXIMUM" << std::endl;
    value=arr_m[0][0];
    index=arr_m[0][1];
    int the_best=index;
    for(int i=0;i<m;i++)
    {
        if(arr_m[i][0]==value)
        {
            if(index<arr_m[i][1])
            {
                value=arr_m[i][0];
                index=arr_m[i][1];
                the_best = index;

            }
        }
        else if(arr_m[i][0]>value)
        {
            value=arr_m[i][0];
            index=arr_m[i][1];
            the_best = index;
        }
    }
    std::cout << the_best << std::endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=b;i>=a;i--)
#define clean(a,b) memset(a,b,sizeof(a))
struct coun
{
    char fig;
    int num;
    coun()
    {
        num = 0;
    }
}figure[30];

bool cmp(coun a,coun b)
{
    if(a.num == b.num)
        return a.fig < b.fig;
    return a.num>b.num;
}

int cnt[300];
int main()
{
    int n;
    while (cin>>n)
    {
        string str;
        cin>>str;
        clean(cnt,0);
        int len=str.size();
        rep(i,0,len-1)
        {
            cnt[str[i]]++;
        }
        string ans = "";
        for (char i ='a';i<='z';i++)
        {
            int tmp = cnt[i];
            while (tmp--)
            {
                ans+=i;
            }

        }
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=b;i>=a;i--)
#define clean(a,b) memset(a,b,sizeof(a))
struct coun
{
    char fig;
    int num;
    coun()
    {
        num = 0;
    }
}figure[30];

bool cmp(coun a,coun b)
{
    if(a.num == b.num)
        return a.fig < b.fig;
    return a.num>b.num;
}

int cnt[300];
int main()
{
    int n;
    while (cin>>n)
    {
        string str;
        cin>>str;
        clean(cnt,0);
        int len=str.size();
        rep(i,0,len-1)
        {
            cnt[str[i]]++;
        }
        for (char i = 'a';i<='z';i++)
        {
            int tmp = i-'a';
            figure[tmp].fig =i;
            figure[tmp].num = cnt[i];
        }
        sort(figure,figure+26,cmp);
        string ans="";
        for (int i=0;i<26;i+=2)
        {
            coun a=figure[i];
            coun b=figure[i+1];
            if(a.num == 0)break;
            if(b.num == 0)
            {
                int tmp = a.num;
                while (tmp--)
                    ans+=a.fig;
                break;
            }
            int tmp =b.num;
            if(b.num==a.num)
            {
                while (tmp--)
                {
                    ans+=a.fig;
                }
                tmp =b.num;
                while (tmp--)
                    ans+=b.fig;
                continue;
            }

            while (tmp--)
            {
                ans+=a.fig;
                ans+=b.fig;
            }
            ans+=a.fig;

        }
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i=a;i<=b;i++)
#define per(i,a,b) for (int i=b;i>=a;i--)
#define clean(a,b) memset(a,b,sizeof(a))
struct coun
{
    char fig;
    int num;
    coun()
    {
        num = 0;
    }
}figure[30];

bool cmp(coun a,coun b)
{
    if(a.num == b.num)
        return a.fig < b.fig;
    return a.num>b.num;
}

int cnt[300];
int main()
{
    int n;
    while (cin>>n)
    {
        string str;
        cin>>str;
        clean(cnt,0);
        int len=str.size();
        rep(i,0,len-1)
        {
            cnt[str[i]]++;
        }
        string ans = "";
        for (char i ='a';i<='z';i++)
        {
            int tmp = cnt[i];
            while (tmp--)
            {
                ans+=i;
            }
        }
        cout<<ans<<endl;
    }
}


#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long ll;
#define ff first
#define ss second
ll maxn=1000000007;
void Fastio()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void solve()
{
	char str[100005],ans[100005],n;
	cin>>n;
	ll a[30]={0},b[30]={0},count=0,flag=0,p,q,j,k=1,l;
	ll i;
	scanf("%s",str);
	//cout<<str<<"\n";
	for(i=0;i<strlen(str);i++)
	{
		a[(ll)str[i]-96]++;
	}
	for(i=1;i<=26;i++)
	{
		p=a[i]%2;
		if(flag==0)
		{
			count=count+1;b[i]++;flag=1;
		}
		q=a[i]-a[i]%2;
		if(q>=2)
			{b[i]=b[i]+q;count=count+q;}
	}
	l=count;
	for(i=1;i<=26;i++)
	{
		if(b[i]==0)
				continue;
		p=b[i];
		if(p%2==0)
		{
			q=p/2;
			for(j=k;j<=k+p/2-1;j++)
			{
				ans[j]=(char)(i+96);
			}
			k=j;
			for(j=l;j>=l-q+1;j--)
			{
				ans[j]=(char)(i+96);
			}
			l=j;
		}
		if(p%2==1)
		{
			q=p/2;
			ans[count/2+1]=(char)(i+96);
			for(j=k;j<=k+p/2-1;j++)
			{
				ans[j]=(char)(i+96);
			}
			k=j;
			for(j=l;j>=l-q+1;j--)
			{
				ans[j]=(char)(i+96);
			}
			l=j;
		}
	}
	for(i=1;i<=count;i++)
		cout<<ans[i];

}
int main(){
	Fastio();
	int T;
	T=1;
	while(T--)
		solve();
	return 0;
}


#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long ll;
#define ff first
#define ss second
ll maxn=1000000007;
void Fastio()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void solve()
{
	ll n;
    string s;

	cin >> n>>s;

    int c[26]={0};
    for(ll i=0; i<n; i++)
    {
    	int x = s[i]-'a';
    	c[x]++;
    }
    char ans[n];
    int x = 0;
    int y = 1;
    ll i = 0;
    while(i<n)
    {
    	while((c[x]==0 || x==y) && x<=26)

    		x++;

    	while((c[y]==0 || y==x) && y<=26)
    		y++;

    	if(c[x]<=c[y] && c[x]!=c[y]-1)
    	{
    		if(x<26)
	    	{
	    		ans[i] = 'a' + x,i++,c[x]--;
	    	}
	    	if(y<26)
	    	{
	    		ans[i] = 'a' + y,c[y]--,i++;
	    	}
    	}
    	else
    	{
    		if(y<26)
	    	{
	    		ans[i] = 'a' + y,c[y]--,i++;
	    	}
	    	if(x<26)
	    	{
	    		ans[i] = 'a' + x,c[x]--,i++;
	    	}
    	}

    }
    cout << ans ;

}
int main(){
	Fastio();
	int T;
	T=1;
	while(T--)
		solve();
	return 0;
}


#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long ll;
#define ff first
#define ss second
ll maxn=1000000007;
void Fastio()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void solve()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int arr[26]={0};
	for(int i=0;i<n;i++)
	{
		arr[s[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(arr[i])
		{
			for(int j=0;j<arr[i];j++)
			{
				cout<<char(i+97);
			}
		}
	}

}
int main(){
	Fastio();
	int T;
	T=1;
	while(T--)
		solve();
	return 0;
}


#include<bits/stdc++.h>
#include <iomanip>
using namespace std;
typedef long long ll;
#define ff first
#define ss second
ll maxn=1000000007;
void Fastio()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void solve()
{
	ll n;
    string s;

	cin >> n;
	cin>>s;

    int c[26]={0};
    for(ll i=0; i<n; i++)
    {
    	int x = s[i]-'a';
    	c[x]++;
    }
    char ans[n];
    int x = 0;
    int y = 1;
    ll i = 0;
    while(i<n)
    {
    	while((c[x]==0 || x==y) && x<=26)

    		x++;

    	while((c[y]==0 || y==x) && y<=26)
    		y++;

    	if(c[x]<=c[y] && c[x]!=c[y]-1)
    	{
    		if(x<26)
	    	{
	    		ans[i] = 'a' + x,i++,c[x]--;
	    	}
	    	if(y<26)
	    	{
	    		ans[i] = 'a' + y,c[y]--,i++;
	    	}
    	}
    	else
    	{
    		if(y<26)
	    	{
	    		ans[i] = 'a' + y,c[y]--,i++;
	    	}
	    	if(x<26)
	    	{
	    		ans[i] = 'a' + x,c[x]--,i++;
	    	}
    	}

    }
    for(int i=0;i<n;i++)
        cout<<ans[i];

}
int main(){
	Fastio();
	int T;
	T=1;
	while(T--)
		solve();
	return 0;
}


// I'll Win, not immediately, but definetely.
#include<bits/stdc++.h>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=n-1;i>=0;--i)
#define range(i,p,q) for(ll i=p;i<=q;++i)
#define tci(i,v) for(auto i=v.begin();i!=v.end();++i)
#define tci1(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define all(v) v.begin(),v.end()
#define all1(v) v.rbegin(),v.rend()
#define pb push_back
#define f first
#define s second
#define sz size()
#define in insert
#define ve vector
#define pr pair<ll,ll>
#define el "\n"
#define ll long long int
#define ld long double
#define T() ll t;cin>>t;while(t--)
using namespace std;
ll inf=pow(10,9)+7;
int main()
{
    sync;
    ll n;cin>>n;
    string s;cin>>s;
    map<char, ll> ma;
    rep(i,n)ma[s[i]]++;
    deque<char> ans;
    deque<pair<char, ll>> more,eq,less;
    tci(i,ma)
    {
        if((i->s)>2)more.pb(*i);
        else if(i->s==2)eq.pb(*i);
        else less.pb(*i);
    }
    while(more.sz and eq.sz)
    {
        pair<char, ll> p1,p2;
        p1 = more.front();
        p2 = eq.front();
        while(p1.s and p2.s)
        {
            ans.pb(p1.f);ans.pb(p2.f);
            p1.s--;p2.s--;
        }
        if(p1.s==0 and p2.s==0)more.pop_front(),eq.pop_front();
        else if(p1.s==0)more.pop_front(),eq[0].s=p2.s;
        else if(p2.s==0)eq.pop_front(),more[0].s=p1.s;
    }
    while(more.sz)
    {
        pair<char, ll> p1,p2;
        p1 = more.front();
        p2 = more.back();
        if(more.sz==1)
        {
            rep(i,p1.s)ans.pb(p1.f);
            break;
        }
        while(p1.s and p2.s)
        {
            ans.pb(p1.f);ans.pb(p2.f);
            p1.s--;p2.s--;
        }
        if(p1.s==0 and p2.s==0 and p1!=p2)more.pop_front(),more.pop_back();
        else if(p1.s==0)more.pop_front(),more.back().s=p2.s;
        else if(p2.s==0)more.pop_back(),more.front().s=p1.s;
    }
    deque<char> ans1;
    while(eq.sz)
    {
        pair<char, ll> p1,p2;
        p1=eq.front();
        p2=eq.back();
        while(p1.s and p2.s)
        {
            ans1.pb(p1.f);
            ans1.push_front(p2.f);
            p1.s--;p2.s--;
        }
        if(p1.s==0 and p2.s==0 and p1!=p2)eq.pop_front(),eq.pop_back();
        else if(p1.s==0)eq.pop_front();
        else if(p2.s==0)eq.pop_back();
    }
    rep(i,less.sz)ans.pb(less[i].f);
    rep(i,ans.sz)cout<<ans[i];
    rep(i,ans1.sz)cout<<ans1[i];
    return 0;
}


// I'll Win, not immediately, but definetely.
#include<bits/stdc++.h>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=n-1;i>=0;--i)
#define range(i,p,q) for(ll i=p;i<=q;++i)
#define tci(i,v) for(auto i=v.begin();i!=v.end();++i)
#define tci1(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define all(v) v.begin(),v.end()
#define all1(v) v.rbegin(),v.rend()
#define pb push_back
#define f first
#define s second
#define sz size()
#define in insert
#define ve vector
#define pr pair<ll,ll>
#define el "\n"
#define ll long long int
#define ld long double
#define T() ll t;cin>>t;while(t--)
using namespace std;
ll inf=pow(10,9)+7;
int main()
{
    sync;
    ll n;cin>>n;
    string s;cin>>s;
    map<char, ll> ma;
    rep(i,n)ma[s[i]]++;
    tci(i,ma)rep(j,i->s)cout<<i->f;
    return 0;
}


// I'll Win, not immediately, but definetely.
#include<bits/stdc++.h>
#define sync ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i,n) for(ll i=0;i<n;++i)
#define rep1(i,n) for(ll i=n-1;i>=0;--i)
#define range(i,p,q) for(ll i=p;i<=q;++i)
#define tci(i,v) for(auto i=v.begin();i!=v.end();++i)
#define tci1(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define all(v) v.begin(),v.end()
#define all1(v) v.rbegin(),v.rend()
#define pb push_back
#define f first
#define s second
#define sz size()
#define in insert
#define ve vector
#define pr pair<ll,ll>
#define el "\n"
#define ll long long int
#define ld long double
#define T() ll t;cin>>t;while(t--)
using namespace std;
ll inf=pow(10,9)+7;
int main()
{
    sync;
    ll n;cin>>n;
    string s;cin>>s;
    map<char, ll> ma;
    rep(i,n)ma[s[i]]++;
    deque<char> ans;
    deque<pair<char, ll>> more,eq,less;
    tci(i,ma)
    {
        if((i->s)>2)more.pb(*i);
        else if(i->s==2)eq.pb(*i);
        else less.pb(*i);
    }
    while(more.sz and eq.sz)
    {
        pair<char, ll> p1,p2;
        p1 = more.front();
        p2 = eq.front();
        while(p1.s and p2.s)
        {
            ans.pb(p1.f);ans.pb(p2.f);
            p1.s--;p2.s--;
        }
        if(p1.s==0 and p2.s==0)more.pop_front(),eq.pop_front();
        else if(p1.s==0)more.pop_front(),eq[0].s=p2.s;
        else if(p2.s==0)eq.pop_front(),more[0].s=p1.s;
    }
    while(more.sz)
    {
        pair<char, ll> p1,p2;
        p1 = more.front();
        p2 = more.back();
        if(more.sz==1)
        {
            rep(i,p1.s)ans.pb(p1.f);
            break;
        }
        while(p1.s and p2.s)
        {
            ans.pb(p1.f);ans.pb(p2.f);
            p1.s--;p2.s--;
        }
        if(p1.s==0 and p2.s==0 and p1!=p2)more.pop_front(),more.pop_back();
        else if(p1.s==0)more.pop_front(),more.back().s=p2.s;
        else if(p2.s==0)more.pop_back(),more.front().s=p1.s;
    }
    deque<char> ans1;
    while(eq.sz)
    {
        pair<char, ll> p1,p2;
        p1=eq.front();
        p2=eq.back();
        while(p1.s and p2.s)
        {
            ans1.pb(p1.f);
            ans1.push_front(p2.f);
            p1.s--;p2.s--;
        }
        if(p1.s==0 and p2.s==0 and p1!=p2)eq.pop_front(),eq.pop_back();
        else if(p1.s==0)eq.pop_front();
        else if(p2.s==0)eq.pop_back();
    }
    rep(i,less.sz)ans.pb(less[i].f);
    rep(i,ans.sz)cout<<ans[i];
    // rep(i,ans1.sz)cout<<ans1[i];
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string str;
    cin >> str;
    int cnt[26];
    for(int i = 0; i < 26; ++i) {
        cnt[i] = 0;
    }
    for(int i = 0; i < n; ++i) {
        cnt[str[i] - 'a']++;
    }
    int q = 0, index;
    for(int i = 0; i < 26; ++i) {
        for(int j = 0; j < cnt[i] / 2; ++j) {
            cout << (char)('a' + i);
        }
        q += cnt[i] % 2;
        if(cnt[i] % 2) {
            index = i;
        }
    }
    if(q == 1) {
        cout << (char)('a' + index);
        --cnt[index];
    }
    for(int i = 25; i >= 0; --i) {
        for(int j = 0; j < cnt[i] / 2; ++j) {
            cout << (char)('a' + i);
        }
        cnt[i] %= 2;
    }
    for(int i = 0; i < 26; ++i) {
        for(int j = 0; j < cnt[i]; ++j) {
            cout << (char)('a' + i);
        }
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string str;
    cin >> str;
    int cnt[26];
    for(int i = 0; i < 26; ++i) {
        cnt[i] = 0;
    }
    for(int i = 0; i < n; ++i) {
        cnt[str[i] - 'a']++;
    }
    for(int i = 0; i < 26; ++i) {
        for(int j = 0; j < cnt[i]; ++j) {
            cout << char(i + 'a');
        }
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string str;
    cin >> str;
    int cnt[26];
    for(int i = 0; i < 26; ++i) {
        cnt[i] = 0;
    }
    for(int i = 0; i < n; ++i) {
        cnt[str[i] - 'a']++;
    }
    int index;
    for(int i = 0; i < 26; ++i) {
        for(int j = 0; j < cnt[i] / 2; ++j) {
            cout << (char)('a' + i);
        }
        if(cnt[i] % 2) {
            index = i;
        }
    }
    cout << (char)('a' + index);
    --cnt[index];
    for(int i = 25; i >= 0; --i) {
        for(int j = 0; j < cnt[i] / 2; ++j) {
            cout << (char)('a' + i);
        }
        cnt[i] %= 2;
    }
    for(int i = 0; i < 26; ++i) {
        for(int j = 0; j < cnt[i]; ++j) {
            cout << (char)('a' + i);
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
//priority_queue<int,vector<int>,greater<int> > mypq;

struct compare{
    bool operator()(pair<char,int> p1,pair<char,int>p2){
        if(p1.second == p2.second)return (p1.first < p1.first);
        return (p1.second < p2.second);
    }
};
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    string s;
    cin >> s;

    unordered_map<int,int>cnt;
    unordered_map<int,int>::iterator iter;
    for(int i = 0;i<n;i++){
        cnt[s[i]]++;
    }
    priority_queue<pair<char,int>,vector<pair<char,int> >,compare > pq0;
    priority_queue<pair<char,int>,vector<pair<char,int> >,compare > pq1;

    for(iter=cnt.begin();iter!=cnt.end();++iter){
        if(iter->second%2 ==0){
            pq0.push({iter->first,iter->second});
        }
        else{
            pq1.push({iter->first,iter->second});
        }
    }
    string res = "";
    while(!pq0.empty() && !pq1.empty()){
            pair<char,int> p0 = pq0.top();
            pair<char,int> p1 = pq1.top();
            pq0.pop();
            pq1.pop();

            if(p0.second>p1.second){
                for(int i = 1;i<=p0.second+p1.second;i++){
                    if(i%2!=0){
                        res += p0.first;
                    }
                    else{
                        res += p1.first;
                    }
                }
            }
            else{
                for(int i = 1;i<=p0.second+p1.second;i++){
                    if(i%2==0){
                        res += p0.first;
                    }
                    else{
                        res += p1.first;
                    }
                }
            }
    }
    string res0 = "";
    while(!pq0.empty()){
        pair<char,int> p0 = pq0.top();
        pq0.pop();
        for(int i=0;i<p0.second;i++){
            if(i%2==0)res0 += p0.first;
            else res0 = p0.first + res0;
        }
    }
    string res1 = "";
    while(!pq1.empty()){
        pair<char,int> p1 = pq1.top();
        pq1.pop();
        for(int i=0;i<p1.second;i++){
            if(i%2==0)res1 += p1.first;
            else res1 = p1.first + res1;
        }
    }

    res = res + res0 + res1 ;
    cout << res << endl;

}