The country of Byalechinsk is running elections involving n candidates. The country consists of m cities. We know how many people in each city voted for each candidate.

The electoral system in the country is pretty unusual. At the first stage of elections the votes are counted for each city: it is assumed that in each city won the candidate who got the highest number of votes in this city, and if several candidates got the maximum number of votes, then the winner is the one with a smaller index.

At the second stage of elections the winner is determined by the same principle over the cities: the winner of the elections is the candidate who won in the maximum number of cities, and among those who got the maximum number of cities the winner is the one with a smaller index.

Determine who will win the elections.


-----Input-----

The first line of the input contains two integers n, m (1 ≤ n, m ≤ 100) — the number of candidates and of cities, respectively.

Each of the next m lines contains n non-negative integers, the j-th number in the i-th line a_{ij} (1 ≤ j ≤ n, 1 ≤ i ≤ m, 0 ≤ a_{ij} ≤ 10^9) denotes the number of votes for candidate j in city i.

It is guaranteed that the total number of people in all the cities does not exceed 10^9.


-----Output-----

Print a single number — the index of the candidate who won the elections. The candidates are indexed starting from one.


-----Examples-----
Input
3 3
1 2 3
2 3 1
1 2 1

Output
2
Input
3 4
10 10 3
5 1 6
2 2 2
1 5 7

Output
1


-----Note-----

Note to the first sample test. At the first stage city 1 chosen candidate 3, city 2 chosen candidate 2, city 3 chosen candidate 2. The winner is candidate 2, he gained 2 votes.

Note to the second sample test. At the first stage in city 1 candidates 1 and 2 got the same maximum number of votes, but candidate 1 has a smaller index, so the city chose candidate 1. City 2 chosen candidate 3. City 3 chosen candidate 1, due to the fact that everyone has the same number of votes, and 1 has the smallest index. City 4 chosen the candidate 3. On the second stage the same number of cities chose candidates 1 and 3. The winner is candidate 1, the one with the smaller index.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
(n, m) = map(int, input().split())
a = [0] * n
for i in range(m):
	b = list(map(int, input().split()))
	a[b.index(max(b))] += 1
print(a.index(max(a)) + 1)


(n, m) = map(int, input().split())
votes = [0] * n
for _ in range(m):
	city_votes = list(map(int, input().split()))
	votes[city_votes.index(max(city_votes))] += 1
print(votes.index(max(votes)) + 1)


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
from fractions import Fraction

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)
(n, m) = mi()
a = n * [0]
for i in range(m):
	x = li()
	a[x.index(max(x))] += 1
print(a.index(max(a)) + 1)


from sys import stdin, stdout, setrecursionlimit
input = stdin.readline
flush = stdout.flush
OUT = []

def write(item, sep=' '):
	if type(item) is int:
		OUT.append(str(item))
	elif type(item) is list:
		if type(item[0]) is int:
			OUT.append(sep.join(map(str, item)))
		else:
			OUT.append(sep.join(item))
	else:
		OUT.append(item)

def PRINT():
	print('\n'.join(OUT))
GI = lambda : int(input())
GS = lambda : input()[:-1]
gi = lambda : list(map(int, input().split()))
gs = lambda : input().split()
(cand, cities) = gi()
winner = [0] * cand
for i in range(cities):
	arr = gi()
	best = arr.index(max(arr))
	winner[best] += 1
write(winner.index(max(winner)) + 1)
PRINT()


(n, m) = map(int, input().split())
gol = [[0] * n for i in range(m)]
ans = [0] * n
for i in range(m):
	gol[i] = list(map(int, input().split()))
for i in range(m):
	maxim = [-1, -1]
	for j in range(n):
		if gol[i][j] > maxim[0]:
			maxim = [gol[i][j], j]
	ans[maxim[1]] += 1
maxim = (-1, -1)
for i in range(n):
	if ans[i] > maxim[0]:
		maxim = [ans[i], i]
print(maxim[1] + 1)


def maximum(L):
	m = L[0]
	ind = 0
	for i in range(1, len(L)):
		if L[i] > m:
			ind = i
			m = L[i]
	return ind
(n, m) = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(m)]
R = [0 for _ in range(n)]
for i in range(m):
	R[maximum(L[i])] += 1
print(maximum(R) + 1)


(n, m) = map(int, input().split())
p = [0] * n
for i in range(m):
	a = list(map(int, input().split()))
	q = max(a)
	for t in range(n):
		if a[t] == q:
			r = t
			break
	p[t] += 1
q = max(p)
for i in range(n):
	if p[i] == q:
		print(i + 1)
		break


from sys import stdin
(n, m) = map(int, stdin.readline().split())
kn = [0] * n
for i in range(0, m):
	a = stdin.readline().split()
	vmax = 0
	vi = 0
	for j in range(0, n):
		if int(a[j]) > vmax:
			vmax = int(a[j])
			vi = j
	kn[vi] += 1
rmax = 0
res = 0
for i in range(0, n):
	if kn[i] > rmax:
		rmax = kn[i]
		res = i + 1
print(res)


(n, m) = map(int, input().split())
dp = [0 for i in range(n)]
for i in range(m):
	t = list(map(int, input().split()))
	mxindex = 0
	for j in range(n):
		if t[j] > t[mxindex]:
			mxindex = j
	dp[mxindex] += 1
mxindex = 0
for i in range(n):
	if dp[i] > dp[mxindex]:
		mxindex = i
print(mxindex + 1)


(n, m) = map(int, input().split())
ll = []
ball = [0] * n
for i in range(m):
	ll.append(list(map(int, input().split())))
for i in range(m):
	k = max(ll[i])
	for j in range(n):
		if ll[i][j] == k:
			ball[j] += 1
			break
k = max(ball)
for i in range(n):
	if ball[i] == k:
		print(i + 1)
		break


def first_that_equals(array, number):
	for i in range(len(array)):
		if array[i] == number:
			return i
	return -1
(candidates, cities) = list(map(int, input().split()))
candidates = [0 for n in range(candidates)]
for i in range(cities):
	votes = list(map(int, input().split()))
	winner = first_that_equals(votes, max(votes))
	candidates[winner] += 1
print(first_that_equals(candidates, max(candidates)) + 1)


(n, m) = [int(i) for i in input().split()]
city = [0] * n
for i in range(m):
	vote = [int(j) for j in input().split()]
	maximum1 = max(vote)
	for j in range(n):
		if vote[j] == maximum1:
			city[j] += 1
			break
maximum2 = max(city)
for k in range(n):
	if city[k] == maximum2:
		print(k + 1)
		break


(n, m) = [int(x) for x in input().split(' ')]
victorias = [0 for x in range(n)]
for i in range(m):
	puntajes = [int(x) for x in input().split(' ')]
	ganador = puntajes.index(max(puntajes))
	victorias[ganador] += 1
print(victorias.index(max(victorias)) + 1)


import sys
import bisect
(n, m) = map(int, input().split())
l = []
winners = []
cnt = [0] * (105 + 1)
for i in range(m):
	ml = list(map(int, input().split()))
	maxi = 0
	for j in ml:
		maxi = max(maxi, j)
	for j in range(n):
		if ml[j] == maxi:
			winners.append(j)
			break
maxi = 0
for i in range(m):
	cnt[winners[i]] += 1
	maxi = max(maxi, cnt[winners[i]])
ans = 1000
for i in range(m):
	if cnt[winners[i]] == maxi:
		ans = min(ans, winners[i] + 1)
print(ans)


(n, m) = map(int, input().split())
b = [0] * n
for i in range(m):
	a = list(map(int, input().split()))
	z = 0
	for j in range(1, len(a)):
		if a[z] < a[j]:
			z = j
	b[z] += 1
z = 0
for j in range(1, len(b)):
	if b[z] < b[j]:
		z = j
print(z + 1)


import sys
sys.setrecursionlimit(1000000)

def solve():
	(n, m) = rv()
	citieswon = [0] * n
	for city in range(m):
		(a,) = rl(1)
		index = 0
		for i in range(n):
			if a[i] > a[index]:
				index = i
		citieswon[index] += 1
	cityindex = 0
	for i in range(n):
		if citieswon[i] > citieswon[cityindex]:
			cityindex = i
	print(cityindex + 1)

def rv():
	return map(int, input().split())

def rl(n):
	return [list(map(int, input().split())) for _ in range(n)]
if sys.hexversion == 50594544:
	sys.stdin = open('test.txt')
solve()


(n, m) = map(int, input().split())
cities = []
for i in range(m):
	votes = list(map(int, input().split()))
	cities += [votes.index(max(votes))]
num_city = 0
votes_city = 0
for i in set(cities):
	if votes_city < cities.count(i):
		votes_city = cities.count(i)
		num_city = i
print(num_city + 1)


(n, m) = map(int, input().split())
k = []
for i in range(m):
	l = [int(q) for q in input().split()]
	k.append(l.index(max(l)))
count = []
for i in range(n):
	count.append(k.count(i))
print(1 + count.index(max(count)))


(m, n) = input().split()
cand = []
for i in range(int(m)):
	cand.append(0)
for i in range(int(n)):
	a = [int(x) for x in input().split()]
	cand[a.index(max(a))] += 1
print(cand.index(max(cand)) + 1)


(n, m) = map(int, input().split())
c = [0] * n
for _ in range(m):
	scores = [int(x) for x in input().split()]
	max_score = 0
	max_index = 0
	for (i, s) in enumerate(scores):
		if s > max_score:
			max_score = s
			max_index = i
	c[max_index] += 1
max_score = 0
max_index = 0
for (i, x) in enumerate(c):
	if x > max_score:
		max_score = x
		max_index = i
print(max_index + 1)


(n, m) = map(int, input().split())
z = [0] * n
for i in range(m):
	l = list(map(int, input().split()))
	c = max(l)
	z[l.index(c)] += 1
print(z.index(max(z)) + 1)


(n, m) = [int(i) for i in input().split()]
cnt = list([0] * (n + 1))
for i in range(m):
	votes = [int(num) for num in input().split()]
	cnt[votes.index(max(votes))] += 1
print(cnt.index(max(cnt)) + 1)


(n, m) = map(int, input().split())
s = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
	s[i] = s[i].index(max(s[i])) + 1
s = sorted(s)
eta = ans = 0
for x in s:
	if s.count(x) > eta:
		ans = x
		eta = s.count(x)
print(ans)


(n, m) = map(int, input().split())
a = []
c = []
for i in range(m):
	l = list(map(int, input().split()))
	a.append(l.index(max(l)) + 1)
for i in range(1, n + 1):
	c.append(a.count(i))
print(c.index(max(c)) + 1)


from operator import itemgetter
fl = input().split()
n = int(fl[0])
m = int(fl[-1])
l = []
for _ in range(m):
	l.append(list(map(int, input().split())))
resf = []
for i in l:
	resf.append(i.index(max(i)) + 1)
m = 0
for i in resf:
	if m < resf.count(i):
		m = resf.count(i)
output = [(a, resf.count(a)) for a in resf]
output = list(set(output))
res = []
for i in output:
	if i[1] == m:
		res.append(i[0])
print(min(res))


(n, m) = map(int, input().split())
t = [0] * n
for i in range(m):
	v = list(map(int, input().split()))
	t[v.index(max(v))] += 1
print(t.index(max(t)) + 1)


(n, m) = (int(x) for x in input().split())
res = [[0, i] for i in range(n)]
for _ in range(m):
	t_res = [[int(v), i] for (i, v) in enumerate(input().split())]
	t_res.sort(key=lambda v: v[1])
	t_res.sort(key=lambda v: v[0], reverse=True)
	res[t_res[0][1]][0] += 1
res.sort(key=lambda v: v[1])
res.sort(key=lambda v: v[0], reverse=True)
print(res[0][1] + 1)


(candidates, cities) = map(int, input().split())
results = [0] * (candidates + 1)
for c in range(cities):
	round1 = list(map(int, input().split()))
	results[round1.index(max(round1)) + 1] += 1
print(results.index(max(results)))


(numb, mumb) = map(int, input().split())
won_town = [0] * numb
for i in range(mumb):
	town = list(map(int, input().split()))
	won_town[town.index(max(town))] += 1
print(won_town.index(max(won_town)) + 1)


(n, m) = map(int, input().split())
a = []
for i in range(m):
	l = list(map(int, input().split()))
	x = l.index(max(l))
	a.append(x + 1)
a.sort()
print(max(a, key=a.count))


(n, m) = map(int, input().split())

def f(a):
	m = max(a)
	return min((i for i in range(n) if a[i] == m)) + 1
b = [0] * n
for i in range(m):
	a = list(map(int, input().split()))
	b[f(a) - 1] += 1
print(f(b))


(n, m) = map(int, input().split())
c = [0] * (n + 1)
for i in range(m):
	city = [int(i) for i in input().split()]
	c[city.index(max(city)) + 1] += 1
print(c.index(max(c)))


(candidates, cities) = map(int, input().split())
candidate = [0 for i in range(candidates)]
for i in range(cities):
	first = list(map(int, input().split()))
	candidate[first.index(max(first))] += 1
print(candidate.index(max(candidate)) + 1)


[n, m] = list(map(int, input().split(' ')))
v1 = []
for i in range(m):
	l = list(map(int, input().split(' ')))
	v1.append(l.index(max(l)) + 1)
v1.sort()
v2 = list(map(lambda x: v1.count(x), v1))
r = v2.index(max(v2))
print(v1[r])


(n, m) = map(int, input().split())
a = [0] * n
for _ in range(m):
	z = list(map(int, input().split()))
	a[z.index(max(z))] += 1
print(a.index(max(a)) + 1)


(x, y) = map(int, input().split())
lst = [[-2, -2]]
lst2 = []
i = 0
j = 0
a = 0
while i < y:
	z = list(map(int, input().split()))
	while j < x:
		for k in range(len(lst)):
			if lst[k][0] != z[j]:
				a += 1
			elif lst[k][0] == z[j]:
				a = 0
				break
		if a == 0:
			lst += [[-1, j + 1]]
		else:
			lst += [[z[j], j + 1]]
		j += 1
	n = max(lst)[1]
	lst2.append(n)
	lst[:] = [[-2, -2]]
	j = 0
	i += 1
lst2.sort()
b = max(lst2, key=lst2.count)
if b != 0:
	print(b)
else:
	print(b + 1)


from math import sqrt
from random import randint

def ip(n):
	if n == 1:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def s2(n):
	a = list(range(n))
	a[1] = 0
	for i in a:
		if i > 1:
			for j in range(i * 2, len(a), i):
				a[j] = 0
	return {i ** 2 for i in a}
x = input().split()
c = int(x[0])
t = int(x[1])
e = [0] * c
for i in range(t):
	i = [int(i) for i in input().split()]
	r = 0
	g = 0
	for f in range(len(i)):
		if i[f] > r:
			r = i[f]
			g = f
	e[g] += 1
r = 0
g = 0
for f in range(len(e)):
	if e[f] > r:
		r = e[f]
		g = f
print(g + 1)


(n, m) = (int(t) for t in input().split())
wins = []
for i in range(m):
	votes = [int(t) for t in input().split()]
	wins.append(votes.index(max(votes)) + 1)
tally = [0 for i in range(n + 1)]
for w in wins:
	tally[w] += 1
print(tally.index(max(tally)))


(n, m) = map(int, input().split())
sitywin = []
for i in range(1, m + 1):
	li = list(map(int, input().split()))
	sitywin.append(li.index(max(li)) + 1)
winner = 0
vote = 0
for i in range(1, n + 1):
	v = sitywin.count(i)
	if v > vote:
		winner = i
		vote = v
print(winner)


import itertools as itls
import operator as op
from collections import Counter

def inputarray(func=int):
	return map(func, input().split())

def diff(v, x=0):
	v = iter(v)
	while True:
		try:
			y = next(v)
			yield (y - x)
			x = y
		except StopIteration:
			return
(cands, cities) = map(int, input().split())
votes = [None] * cities
for i in range(cities):
	A = list(inputarray())
	votes[i] = A.index(max(A)) + 1
print(Counter(votes).most_common(1)[0][0])


(n, m) = map(int, input().split())
counts = [0] * n
for _ in range(m):
	votes = [int(x) for x in input().split()]
	counts[votes.index(max(votes))] += 1
print(counts.index(max(counts)) + 1)


(n, m) = map(int, input().split(' '))
arr = [[int(i) for i in input().split(' ')] for j in range(m)]
idx_maxi = [int(0) for i in range(int(100.0 + 5))]
for i in range(m):
	maxi_element = max(arr[i])
	idx_maxi_element = arr[i].index(maxi_element)
	idx_maxi[idx_maxi_element] += 1
maxi_idx = max(idx_maxi)
res = idx_maxi.index(maxi_idx)
print(res + 1)


(n, m) = map(int, input().split())
ij = [list(map(int, input().split())) for i in range(m)]
ni = [0] * n
for i in range(m):
	maxi = 0
	num = 0
	for j in range(n):
		if ij[i][j] > maxi:
			maxi = ij[i][j]
			num = j
	ni[num] += 1
maxi = 0
num = 0
for i in range(n):
	if ni[i] > maxi:
		maxi = ni[i]
		num = i
print(num + 1)


inp = input().split()
nn = int(inp[0])
nc = int(inp[1])
cit = []
can = []
for i in range(nc):
	dat = [int(x) for x in input().split()]
	cit.append(dat)
for n in range(nn):
	can.append(0)
for c in cit:
	y = c.index(max(c))
	can[y] = can[y] + 1
print(can.index(max(can)) + 1)


(n, m) = [int(i) for i in input().split()]
a = []
for i in range(m):
	a.append([int(j) for j in input().split()])
b = []
for i in range(m):
	b.append(a[i].index(max(a[i])))
c = [0 for i in range(n)]
for j in range(n):
	for i in range(m):
		if b[i] == j:
			c[j] += 1
print(c.index(max(c)) + 1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	(n, m) = LI()
	aa = [LI() for _ in range(m)]
	c = [0] * n
	for a in aa:
		t = 0
		m = a[0]
		for i in range(1, n):
			if m < a[i]:
				t = i
				m = a[i]
		c[t] += 1
	t = 0
	m = c[0]
	for i in range(1, n):
		if m < c[i]:
			t = i
			m = c[i]
	return t + 1
print(main())


(n, m) = [int(s) for s in input().split()]
a = list()
cities = [0 for s in range(m)]
cands = [0 for s in range(n + 1)]
for i in range(m):
	a.append([int(s) for s in input().split()])
	cities[i] = a[i].index(max(a[i]))
for i in cities:
	cands[i + 1] += 1
print(cands.index(max(cands)))


(n, m) = map(int, input().split())
l_pob = []
l_pr = [0 for i in range(n)]
for i in range(m):
	l = input().split()
	for j in range(n):
		l[j] = int(l[j])
	max_l = l.index(max(l))
	l_pob.append(max_l)
for i in range(m):
	l_pr[l_pob[i]] += 1
print(l_pr.index(max(l_pr)) + 1)


(a, b) = map(int, input().split())
c = []
for i in range(b):
	l = list(map(int, input().split()))
	c.append(l.index(max(l)) + 1)
max = 0
f = 0
for j in range(1, a + 1):
	if c.count(j) > max:
		max = c.count(j)
		f = j
print(f)


(a, b) = input().split()
a = int(a)
b = int(b)
c = [0 for i in range(a)]
for i in range(b):
	d = input().split()
	z = int(d[0])
	r = 0
	for i in range(1, a):
		if int(d[i]) > z:
			z = int(d[i])
			r = i
	c[r] += 1
z = c[0]
r = 0
for i in range(1, a):
	if c[i] > z:
		z = c[i]
		r = i
print(r + 1)


(n, m) = map(int, input().split())
x = [0] * n
while m:
	a = list(map(int, input().split()))
	b = max(a)
	x[a.index(b)] += 1
	m -= 1
c = max(x)
print(x.index(c) + 1)


(n, m) = list(map(int, input().split()))
x = []
for i in range(m):
	a = list(map(int, input().split()))
	x.append(a.index(max(a)) + 1)
x1 = list(set(x))
x1.sort()
x1.sort(reverse=True, key=lambda j: x.count(j))
print(x1[0])


(n, m) = [int(x) for x in input().split()]
winners = []
for i in range(m):
	votes = [int(x) for x in input().split()]
	winner = votes.index(max(votes)) + 1
	winners.append(winner)
cnt = [(x, winners.count(x)) for x in set(winners)]
print(max(cnt, key=lambda e: (e[1], -e[0]))[0])


(n, m) = map(int, input().split())
win = list()
for j in range(n):
	win.append(0)
for i in range(m):
	a = list(map(int, input().split()))
	c = max(a)
	for k in range(n):
		if a[k] == c:
			win[k] += 1
			break
d = max(win)
for i in range(n):
	if win[i] == d:
		print(i + 1)
		quit()


first = input().split()
matrix = list()
results = list()
for c in range(0, int(first[1])):
	matrix.append(input().split())
for c in range(0, int(first[0])):
	results.append(0)
for c in matrix:
	i = '0'
	j = 0
	for k in range(0, int(first[0])):
		if int(c[k]) > int(i):
			i = c[k]
			j = k
	results[j] += 1
print(results.index(max(results)) + 1)


(n, m) = [int(i) for i in input().split()]
res = [0] * n
for i in range(m):
	s = [int(j) for j in input().split()]
	m = s[0]
	mi = 0
	for j in range(n):
		if s[j] > m:
			m = s[j]
			mi = j
	res[mi] += 1
m = res[0]
mi = 0
for k in range(n):
	if res[k] > m:
		m = res[k]
		mi = k
print(mi + 1)


(n, m) = list(map(int, input().split()))
final_candidates = list()

def max_index(a):
	max_value = a[0]
	max_index = 0
	for i in range(len(a)):
		if a[i] > max_value:
			max_index = i
			max_value = a[i]
	return (max_index, max_value)
stats = [0 for i in range(n)]
for i in range(m):
	a = list(map(int, input().split()))
	(mi, mv) = max_index(a)
	stats[mi] += 1
(mi, mv) = max_index(stats)
print(mi + 1)


(a, b) = map(int, input().split())
exec('c=' + '[' + '0,' * (a - 1) + '0]')
for i in range(b):
	d = list(map(int, input().split()))
	c[d.index(max(d))] += 1
print(c.index(max(c)) + 1)


(n, m) = input().split()
n = int(n)
m = int(m)
arr = [[int(i) for i in input().split()] for j in range(m)]
arr1 = [0] * m
for i in range(m):
	arr1[i] = arr[i].index(max(arr[i])) + 1
arr2 = [0] * n
for i in range(n):
	arr2[i] = arr1.count(i + 1)
print(arr2.index(max(arr2)) + 1)


(n, m) = map(int, input().strip().split(' '))
can = []
for i in range(n):
	can.append(0)
for i in range(m):
	lst = list(map(int, input().strip().split(' ')))
	ind = lst.index(max(lst))
	can[ind] += 1
j = can.index(max(can))
print(j + 1)


(n, m) = [int(i) for i in input().split()]
a = []
b = [0] * n
for i in range(m):
	a.append([int(j) for j in input().split()])
	k = 0
	for j in range(1, n):
		if a[-1][j] > a[-1][k]:
			k = j
	a[-1] = k
	b[k] += 1
q = max(b)
for i in range(n):
	if b[i] == q:
		print(i + 1)
		return


(condidats, city) = input().split(' ')
li = [0 for i in range(int(city))]
lp = [0 for i in range(int(condidats))]
max = 0
maxIndex = 0
for i in range(int(city)):
	li[i] = list(map(int, input().split(' ')))
	for j in range(int(condidats)):
		if li[i][j] > max:
			max = li[i][j]
			maxIndex = j
	lp[maxIndex] += 1
	max = 0
	maxIndex = 0
max = 0
maxIndex = 0
for i in range(int(condidats)):
	if lp[i] > max:
		max = lp[i]
		maxIndex = i
print(maxIndex + 1)


(n, m) = map(int, input().split())
s = [list(map(int, input().split())) for i in range(m)]
max_c = [0 for i in range(n)]
for i in range(m):
	maxx = -1
	for j in range(n):
		if s[i][j] > maxx:
			c = j
			maxx = s[i][j]
	max_c[c] += 1
maxx = -1
ans = 0
for i in range(n):
	if max_c[i] > maxx:
		maxx = max_c[i]
		ans = i + 1
print(ans)


(n, m) = map(int, input().split())
matrix = [[int(i) for i in input().split()] for j in range(m)]
winners = []
for i in matrix:
	for j in range(len(i)):
		if i[j] == max(i):
			winners.append(j)
			break
array = [winners.count(i) for i in winners]
array2 = []
for i in range(len(winners)):
	if array[i] == max(array):
		array2.append(winners[i])
print(min(array2) + 1)


def main():
	(n, m) = [int(t) for t in input().split()]
	city_votes = [0] * n
	for _ in range(m):
		votes = [int(t) for t in input().split()]
		max_index = 0
		max_vote = votes[0]
		for (index, vote) in enumerate(votes):
			if vote > max_vote:
				max_vote = vote
				max_index = index
		city_votes[max_index] += 1
	max_index = 0
	max_vote = city_votes[0]
	for (index, city_vote) in enumerate(city_votes):
		if city_vote > max_vote:
			max_vote = city_vote
			max_index = index
	print(max_index + 1)
main()


n = input().split(' ')
(n, m) = (int(n[0]), int(n[1]))
arr = []
for each in range(m):
	a = list(map(int, input().split(' ')))
	arr.append(a)
d = []
for each in arr:
	a = each.index(max(each))
	d.append(a)
a = {}
for each in d:
	if each in a:
		a[each] += 1
	else:
		a[each] = 1
maxx = max(list(a.values()))
b = []
for each in a:
	if a[each] == maxx:
		b.append(each)
print(min(b) + 1)


(n, m) = map(int, input().split())
z = [0] * n
for x in range(m):
	k = list(map(int, input().split()))
	c = -1
	for y in range(n):
		if k[y] > c:
			c = k[y]
			ind = y
	z[ind] += 1
q = max(z)
for x in range(n):
	if z[x] == q:
		print(x + 1)
		break


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from itertools import *
(n, m) = f()
l1 = []
mx = 0
ind = 0
for i in range(m):
	l = il()
	l1.append(l.index(max(l)) + 1)
l1.sort()
for (i, j) in groupby(l1):
	x = len(list(j))
	if mx < x:
		ind = i
		mx = x
print(ind)


from itertools import permutations
from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
import itertools
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(n, m) = map(int, input().split())
arr = []
for _ in range(m):
	brr = list(map(int, input().split()))
	arr.append(brr.index(max(brr)) + 1)
arr.sort()
(winner, count, mx) = (0, 1, 0)
for i in range(m - 1):
	if arr[i] == arr[i + 1]:
		count += 1
	else:
		if count > mx:
			mx = count
			winner = arr[i]
		count = 1
if count > mx:
	winner = arr[-1]
print(winner)


def determine_winner(cities_data):
	cities_winners = []
	winners = []
	for i in range(len(cities_data)):
		max_votes = 0
		for j in range(len(cities_data[i])):
			if cities_data[i][j] >= max_votes:
				max_votes = cities_data[i][j]
		for z in range(len(cities_data[i])):
			if cities_data[i][z] == max_votes:
				winners.append(z)
				break
	winners.sort()
	element = 0
	count = 0
	for i in range(len(winners)):
		temp_element = winners[i]
		temp_count = 0
		for j in range(len(winners)):
			if winners[j] == temp_element:
				temp_count += 1
		if temp_count > count:
			count = temp_count
			element = temp_element
	return element + 1

def convert_into_int(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr
inputs_nums = input().split(' ')
inputs_nums = convert_into_int(inputs_nums)
inputs_data = []
for i in range(inputs_nums[1]):
	input_data = input().split(' ')
	input_data = convert_into_int(input_data)
	inputs_data.append(input_data)
print(determine_winner(inputs_data))


from collections import defaultdict
(n, m) = map(int, input().split())
d = defaultdict(lambda : 0)
grid = []
for i in range(m):
	row = [int(a) for a in input().split()]
	grid.append(row)
winners = []
for i in range(m):
	mx = 0
	for j in range(n):
		mx = max(mx, grid[i][j])
	for j in range(n):
		if grid[i][j] == mx:
			d[j + 1] += 1
			winners.append(j + 1)
			break
max_wins = 0
for w in winners:
	max_wins = max(max_wins, d[w])
winners.sort()
for w in winners:
	if max_wins == d[w]:
		print(w)
		break


(n, m) = (int(x) for x in input().split())
winners = [0] * n
for i in range(m):
	a = [int(x) for x in input().split()]
	winners[a.index(max(a))] += 1
print(winners.index(max(winners)) + 1)


(n, m) = map(int, input().split())
cand = [0] * n
for i in range(m):
	li = list(map(int, input().split()))
	li_max = max(li)
	cand[li.index(li_max)] += 1
print(cand.index(max(cand)) + 1)


(cand, count) = map(int, input().split())
mylist = [0] * (cand + 1)
for i in range(count):
	citylist = list(map(int, input().split()))
	mylist[citylist.index(max(citylist)) + 1] += 1
print(mylist.index(max(mylist)))


(n, m) = map(int, input().split(' '))
city_winners = list()
for i in range(m):
	city_votes = list(map(int, input().split(' ')))
	city_winners.append(city_votes.index(max(city_votes)))
maxcount = 0
winner = 0
for i in range(n):
	if city_winners.count(i) > maxcount:
		maxcount = city_winners.count(i)
		winner = i
print(winner + 1)


import operator

def winner(votes):
	(max_index, max_value) = max(enumerate(votes), key=operator.itemgetter(1))
	return max_index
(n, m) = map(int, input().split())
votes = [0 for i in range(n)]
for i in range(m):
	votes[winner(list(map(int, input().split())))] += 1
print(1 + winner(votes))


from collections import OrderedDict
(n, m) = list(map(int, input().split()))
winner = []
for i in range(m):
	s = list(map(int, input().split()))[:n]
	p = s[0]
	w = 0
	for j in range(n):
		if s[j] > p:
			p = s[j]
			w = j
	winner.append(w + 1)
fre = {}
fre1 = {}
for i in winner:
	if i in fre:
		fre[i] += 1
	else:
		fre[i] = 1
fre1 = OrderedDict(sorted(fre.items()))
print(max(fre1, key=fre1.get))


import statistics
from statistics import mode
(n, m) = map(int, input().split())
w = []
for _ in range(m):
	l = list(map(int, input().split()))
	m = max(l)
	for i in range(n):
		if l[i] == m:
			a = i
			break
	w.append(a + 1)
w.sort()
print(mode(w))


(n, m) = map(int, input().split())
mans = [0] * n
ans = 1
for i in range(m):
	a = [int(s) for s in input().split()]
	mans[a.index(max(a))] += 1
print(mans.index(max(mans)) + 1)


import time
(n, m) = (int(i) for i in input().split())
A = [0 for i in range(m)]
for i in range(m):
	buf = [int(j) for j in input().split()]
	max = -1
	for j in range(n):
		if max < buf[j]:
			max = buf[j]
			A[i] = j + 1
start = time.time()
ans = False
max = -1
for i in set(A):
	s = sum([1 for j in A if j == i])
	if s > max:
		ans = i
		max = s
	if ans != False and s == max:
		if ans > i:
			ans = i
print(ans)
finish = time.time()


(a, b) = map(int, input().split())
res = [0] * a
maxi = 0
ind = 0
for _ in range(b):
	lis = map(int, input().split())
	for (indx, value) in enumerate(lis):
		if value > maxi:
			maxi = value
			ind = indx
	res[ind] += 1
	maxi = ind = 0
maxi = max(res)
for i in range(len(res)):
	if res[i] == maxi:
		print(i + 1)
		break


import collections

def f():
	(n, m) = [int(c) for c in input().split()]
	r = []
	for i in range(m):
		a = [int(c) for c in input().split()]
		jj = a.index(max(a)) + 1
		r.append(jj)
	c = collections.Counter(r)
	mm = 0
	for k in c:
		if c[k] > mm:
			mm = c[k]
	for k in sorted(c.keys()):
		if c[k] == mm:
			return k
print(f())


(kon, n_gorod) = map(int, input().split())
t = [0] * kon
for i in range(n_gorod):
	sp = list(map(int, input().split()))
	t[sp.index(max(sp))] += 1
print(t.index(max(t)) + 1)


from functools import cmp_to_key

def mp():
	return map(int, input().split())

def lt():
	return list(map(int, input().split()))

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def printlist(l):
	print(''.join([str(x) for x in l]))

def listring(l):
	return ''.join([str(x) for x in l])

def g(i, j):
	if i[1] > j[1] or (i[1] == j[1] and i[0] < j[0]):
		return 1
	return -1
(n, m) = mp()
a = [0 for i in range(n)]
for i in range(m):
	r = lt()
	L = [(x, r[x]) for x in range(n)]
	L.sort(key=cmp_to_key(g), reverse=True)
	a[L[0][0]] += 1
s = [(x, a[x]) for x in range(n)]
s.sort(key=cmp_to_key(g), reverse=True)
print(s[0][0] + 1)


(n, m) = map(int, input().split())
d = {}
for i in range(m):
	a = list(map(int, input().split()))
	d[a.index(max(a)) + 1] = d.get(a.index(max(a)) + 1, 0) + 1
ans = []
for i in d.keys():
	if d[i] == max(d.values()):
		ans.append(i)
print(min(ans))


string = input()
numbers = string.split(' ')
candidates = int(numbers[0])
cities = int(numbers[1])
wins = [0 for x in range(candidates)]
for x in range(cities):
	string = input()
	votes = string.split(' ')
	for y in range(candidates):
		votes[y] = int(votes[y])
	maximum = max(votes)
	candidate = votes.index(maximum)
	wins[candidate] += 1
maximum = max(wins)
candidate = wins.index(maximum)
print(candidate + 1)


(n, m) = [int(i) for i in input().split()]
wins = [0 for i in range(n)]
for city in range(m):
	data = [int(i) for i in input().split()]
	w = 0
	for i in range(1, len(data)):
		if data[i] > data[w]:
			w = i
	wins[w] += 1
m = max(wins)
for i in range(len(wins)):
	if wins[i] == m:
		print(i + 1)
		quit()


(n, m) = [int(i) for i in input().split()]
lst = [[int(i) for i in input().split()] for j in range(m)]
(a, b) = ([0] * m, [0] * n)
for i in range(m):
	a[i] = lst[i].index(max(lst[i])) + 1
for i in range(n):
	b[i] = a.count(i + 1)
print(b.index(max(b)) + 1)


(n, m) = map(int, input().split())
s = [0] * 100
for i in range(m):
	l = list(map(int, input().split()))
	k = max(l)
	for j in range(n):
		if l[j] == k:
			s[j] = s[j] + 1
			break
s1 = [i for i in range(n) if s[i] == max(s)]
print(s1[0] + 1)


(n, m) = str(input()).split()
n = int(n)
m = int(m)
temp_list = [0] * n
for i in range(m):
	line = str(input()).split()
	line = [int(it) for it in line]
	temp_list[line.index(max(line))] += 1
print(temp_list.index(max(temp_list)) + 1)


s = input().split()
n = int(s[0])
m = int(s[1])
v = []
for i in range(m):
	v.append(list(map(int, input().split())))
p = list(map(max, v))
l = []
for i in range(m):
	l.append(v[i].index(p[i]))
del p
del v
k = 0
for e in set(l):
	r = l.count(e)
	if r > k:
		k = r
		p = e
del l
print(p + 1)


(candidates_number, city_number) = map(int, input().split())
candidate_indexes = range(candidates_number)
candidates = {}
for i in range(city_number):
	vote = [int(j) for j in input().split()]
	city_winner = max(candidate_indexes, key=lambda candidate: vote[candidate])
	if city_winner in candidates:
		candidates[city_winner] += 1
	else:
		candidates[city_winner] = 1
print(max(candidates, key=lambda candidate: candidates[candidate]) + 1)


(n1, m1) = input().split()
n = int(n1)
m = int(m1)
l = []
for i in range(m):
	s = list(map(int, input().split()))
	l.append(s)
l1 = [0] * n
for val in l:
	l1[val.index(max(val))] += 1
print(l1.index(max(l1)) + 1)


(n, m) = [int(x) for x in input().split()]
a = [[int(x) for x in input().split()] for i in range(m)]
firstStage = [1] * m
eachperson = {}
for i in range(1, n + 1):
	eachperson[i] = 0
mav1 = 1
mav2 = 0
for i in range(m):
	maxV1 = 0
	for j in range(n):
		if a[i][j] > maxV1:
			maxV1 = a[i][j]
			firstStage[i] = j + 1
	eachperson[firstStage[i]] += 1
for x in eachperson:
	if eachperson[x] > mav2:
		mav1 = x
		mav2 = eachperson[x]
print(mav1)


def in_int():
	return map(int, input().split())
(n, m) = in_int()
a = [list(in_int()) for _ in range(m)]

def max_i(a):
	max = 0
	maxi = 0
	for i in range(len(a)):
		if a[i] > max:
			max = a[i]
			maxi = i
	return maxi
v = [0] * n
for i in map(max_i, a):
	v[i] += 1
print(max_i(v) + 1)


import sys
fin = sys.stdin
[n, m] = [int(x) for x in fin.readline().split()]
votes = [0] * n
for i in range(m):
	_votes = [int(x) for x in fin.readline().split()]
	sel = _votes.index(max(_votes))
	votes[sel] += 1
print(str(1 + votes.index(max(votes))) + '\n')
fin.close()


(people, city) = map(int, input().split())
data = []
result = [int(0) for i in range(people)]
for i in range(city):
	data.append([int(i) for i in input().split()])
for array in data:
	win_index = array.index(max(array))
	result[win_index] += 1
print(result.index(max(result)) + 1)


(n, m) = map(int, input().split())
z = []
for i in range(m):
	x = [int(x) for x in input().split()]
	z.append(1 + x.index(max(x)))
p = list(set(z))
k = 0
for i in p:
	if z.count(i) > k:
		k = z.count(i)
		s = i
print(s)


(n, m) = map(int, input().split())
l = []
for f in range(n):
	l.append(0)
for f1 in range(m):
	i = list(map(int, input().split()))
	ma = 0
	for f2 in range(n):
		if i[f2] > i[ma]:
			ma = f2
	l[ma] += 1
ma = 0
for f in range(n):
	if l[f] > l[ma]:
		ma = f
print(ma + 1)


from collections import Counter
from functools import reduce
(n, m) = map(int, input().split())
s = 0
c = Counter()
for i in range(m):
	a = list(map(int, input().split()))
	c[max(range(n), key=lambda i: a[i])] += 1
print(c.most_common()[0][0] + 1)


(n, m) = map(int, input().split())
a = list()
for i in range(m):
	a.append([int(i) for i in input().split()])
if n == 1:
	print(1)
elif m == 1:
	x = 1
	y = 0
	for i in range(n):
		if y < a[0][i]:
			y = a[0][i]
			x = i + 1
	print(x)
else:
	k = [0] * m
	for i in range(m):
		x = -1
		for j in range(n):
			if a[i][j] > x:
				x = a[i][j]
				k[i] = j + 1
	k = sorted(k)
	(h, x, y) = (1, 0, 1)
	for i in range(len(k) - 1):
		if k[i] == k[i + 1]:
			h += 1
			if x < h:
				x = h
				y = k[i]
		else:
			h = 1
	print(y)


(n, m) = [int(x) for x in input().split()]
final = [[0, i] for i in range(n)]
for i in range(m):
	result = [int(x) for x in input().split()]
	first = [[result[j], j] for j in range(n)]
	first = sorted(first, key=lambda x: (-x[0], x[1]))
	final[first[0][1]][0] += 1
final = sorted(final, key=lambda x: (-x[0], x[1]))
print(final[0][1] + 1)


(n, m) = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(m)]
cnt = [0 for _ in range(n)]
for aa in A:
	maxv = max(aa)
	for i in range(n):
		if aa[i] == maxv:
			cnt[i] += 1
			break
maxcnt = max(cnt)
for i in range(n):
	if cnt[i] == maxcnt:
		print(i + 1)
		exit()


(n, m) = map(int, input().split())
result = []
for _ in range(m):
	x = list(map(int, input().split()))
	result.append(x.index(max(x)) + 1)
m = 0
for i in range(1, n + 1):
	d = result.count(i)
	if d > m:
		m = d
		a = i
print(a)


(n, m) = list(map(int, input().split()))
x = []
for i in range(0, m):
	a = list(map(int, input().split()))
	c = max(a)
	for j in range(0, n):
		if a[j] == c:
			x.append(j + 1)
			break
		else:
			continue
z = 0
zz = []
for j in range(0, n):
	for i in range(0, m):
		if x[i] == j + 1:
			z += 1
		else:
			continue
	zz.append(z)
	z = 0
d = max(zz)
for i in range(0, n):
	if zz[i] == d:
		print(i + 1)
		break
	else:
		continue


(n, m) = [int(x) for x in input().split()]
candidate = [0] * n
for i in range(m):
	vote = [int(x) for x in input().split()]
	winner_city = vote.index(max(vote))
	candidate[winner_city] += 1
winner = candidate.index(max(candidate))
print(winner + 1)


(a, b) = map(int, input().split())
arr = []
h = 0
while b:
	b -= 1
	l = list(map(int, input().split()))
	h = max(l)
	arr.append(l.index(max(l)) + 1)
print(max(set(arr), key=arr.count))


(n, m) = input().split()
winners = [0] * int(n)
for i in range(int(m)):
	cands = input().split()
	cands_normalized = [int(x) for x in cands]
	winners[cands_normalized.index(max(cands_normalized))] += 1
print(winners.index(max(winners)) + 1)


(n, m) = [int(i) for i in input().split(' ')]
res = []
for i in range(m):
	row = [int(j) for j in input().split(' ')]
	res.append(row)
candidates = [0] * n
for city_res in res:
	max_elect = max(city_res)
	winner = city_res.index(max_elect)
	candidates[winner] += 1
max_vote = max(candidates)
print(candidates.index(max_vote) + 1)


(n, m) = map(int, input().split())
results = [0] * n
for _ in range(m):
	votes = [int(vote) for vote in input().split()]
	maxvote = -1
	winnercity = -1
	for i in range(n):
		if votes[i] > maxvote:
			maxvote = votes[i]
			winnercity = i
	results[winnercity] += 1
maxvote = -1
winnercity = -1
for i in range(n):
	if results[i] > maxvote:
		maxvote = results[i]
		winnercity = i
print(winnercity + 1)


from collections import Counter
(n, m) = map(int, input().strip().split())
winners = []
for i in range(m):
	arr = list(map(int, input().strip().split()))
	winners.append(arr.index(max(arr)) + 1)
freq = Counter(winners)
maxFreq = max(freq.values())
winners.sort()
for winner in winners:
	if freq[winner] == maxFreq:
		print(winner)
		break


(n, m) = map(int, input().split())
p = []
for _ in range(m):
	l = list(map(int, input().split()))
	a = max(l)
	p.append(l.index(a))
p.sort()
print(max(set(p), key=p.count) + 1)


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
(n, m) = map(int, input().split())
p = [0] * n
for i in range(m):
	a = list(map(int, input().split()))
	p[a.index(max(a))] += 1
print(1 + p.index(max(p)))


def R():
	return map(int, input().split())
(n, m) = R()
A = [0 for i in range(n)]
for i in range(m):
	str = list(R())
	A[str.index(max(str))] += 1
print(A.index(max(A)) + 1)


from sys import stdin
(N, M) = map(int, stdin.readline().split())
city_votes = []
for m in range(M):
	city_votes.append(list(map(int, stdin.readline().split())))
city_winner = []
for city in range(M):
	city_winner.append(city_votes[city].index(max(city_votes[city])))
freq = [0] * N
for winner in city_winner:
	freq[winner] += 1
print(freq.index(max(freq)) + 1)


(n, m) = map(int, input().split())
arr = [0] * m
for j in range(m):
	minind = 0
	ar = list(map(int, input().split()))
	for i in range(n):
		if ar[i] > ar[minind]:
			minind = i
	arr[j] = (ar[minind], minind)
mini = 0
ans = [0] * n
for i in arr:
	ans[i[1]] += 1
mini = 0
for i in range(n):
	if ans[i] > ans[mini]:
		mini = i
print(mini + 1)


overall = [0] * 105
(n, m) = map(int, input().split())
for m in range(m):
	a = list(map(int, input().split()))
	overall[a.index(max(a)) + 1] += 1
print(overall.index(max(overall)))


def main():
	(n, m) = map(int, input().split())
	l = [0] * n
	for _ in range(m):
		tmp = list(map(int, input().split()))
		l[max(range(n), key=tmp.__getitem__)] += 1
	print(max(range(n), key=l.__getitem__) + 1)
main()


import sys
(n, m) = map(int, sys.stdin.readline().split())
blist = [0] * n
for i in range(m):
	alist = list(map(int, sys.stdin.readline().split()))
	m = max(alist)
	idx = alist.index(m)
	blist[idx] += 1
m = max(blist)
print(1 + blist.index(m))


(n, m) = map(int, input().split())
c = []
for i in range(n):
	c.append(0)
for j in range(m):
	city = list(map(int, input().split()))
	k = city.index(max(city))
	c[k] += 1
print(c.index(max(c)) + 1)


n = input().split(' ')
d = {}
k = 0
max_value = 0
s = 0
for i in range(int(n[1])):
	m = input().split(' ')
	m = list(map(int, m))
	maxindex = m.index(max(m))
	if maxindex in d:
		d[maxindex] += 1
	else:
		d[maxindex] = 1
for (key, value) in d.items():
	if value > max_value:
		max_value = value
		s = key
	if value == max_value and key < s:
		s = key
print(s + 1)


(N, M) = input().split(' ')
N = int(N)
M = int(M)
winners = []

def winning_index(arr):
	sort_by = [(-votes, candidate) for (candidate, votes) in enumerate(arr)]
	return sorted(sort_by)[0][1]
for i in range(M):
	votes_for_candidate = list(map(int, input().split(' ')))
	winners += [winning_index(votes_for_candidate)]
cvotes_for = [0] * N
for winner in winners:
	cvotes_for[winner] += 1
print(winning_index(cvotes_for) + 1)


(N, M) = [int(x) for x in input().split()]
results = [0] * N
for i in range(M):
	city_results = [int(x) for x in input().split()]
	city_max = max(city_results)
	city_max_idx = city_results.index(city_max)
	results[city_max_idx] += 1
max_result = max(results)
max_index = results.index(max_result)
print(max_index + 1)


def main():
	from sys import stdin, stdout
	(n, m) = map(int, stdin.readline().split())
	l = []
	for _ in range(n):
		l.append(0)
	for _ in range(m):
		line = tuple(map(int, stdin.readline().split()))
		l[line.index(max(line))] += 1
	stdout.write(str(l.index(max(l)) + 1))
main()


is_debug = False
(n, m) = map(int, input().split())
v = [0] * n
for _ in range(m):
	a = list(map(int, input().split()))
	c = -1
	x = -1
	for i in range(len(a)):
		if x < a[i]:
			c = i
			x = a[i]
	print(f'c={c}') if is_debug else ''
	v[c] += 1
print(f'v={v}') if is_debug else ''
c = 0
x = -1
for i in range(len(v)):
	if x < v[i]:
		c = i
		x = v[i]
print(f'{c + 1}')


nums = input().split()
n = int(nums[0])
m = int(nums[1])
citywins = [0 for cand in range(n + 1)]
for i in range(m):
	votes = input().split()
	themax = -1
	index = -1
	for c in range(n):
		if int(votes[c]) > themax:
			themax = int(votes[c])
			index = c + 1
	citywins[index] += 1
themax = -1
index = -1
for c in range(1, len(citywins)):
	if citywins[c] > themax:
		themax = citywins[c]
		index = c
print(index)


def solve():
	(n, m) = map(int, input().split())
	a = []
	for i in range(m):
		x = list(map(int, input().split()))
		a.append(x.index(max(x)))
	b = []
	for i in range(n):
		b.append(a.count(i))
	print(b.index(max(b)) + 1)
try:
	solve()
except:
	pass


(n, m) = map(int, input().split())
h = {}
for i in range(m):
	a = [int(x) for x in input().split()]
	max_a = max(a)
	ind = a.index(max_a)
	if h.get(ind) == None:
		h[ind] = 1
	else:
		h[ind] += 1
max_v = max(h.values())
for key in sorted(h.keys()):
	if h[key] == max_v:
		print(key + 1)
		break


__author__ = 'artyom'

def main():
	(n, m) = read(3)
	c = [0] * n
	for _ in range(m):
		mx = mx_i = -1
		v = read(3)
		for i in range(n):
			if v[i] > mx:
				mx = v[i]
				mx_i = i
		c[mx_i] += 1
	mx = mx_i = -1
	for i in range(n):
		if c[i] > mx:
			mx = c[i]
			mx_i = i
	return mx_i + 1

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
res = main()
write(res)


(n, m) = map(int, input().split())
ans = [0] * n
for i in range(m):
	ls = list(map(int, input().split()))
	ans[ls.index(max(ls))] += 1
print(ans.index(max(ans)) + 1)


(n, m) = list(map(int, input().split()))
lst = [[int(x) for x in input().split()] for _ in range(m)]
tmp_lst = []
for row in lst:
	tmp_lst.append(row.index(max(row)))
tmp_tmp_lst = [0] * (n + 7)
for x in tmp_lst:
	tmp_tmp_lst[x] += 1
print(tmp_tmp_lst.index(max(tmp_tmp_lst)) + 1)


(n, m) = map(int, input().split())
d = {}
for i in range(m):
	mn = -1
	l = [int(x) for x in input().split()]
	id = l.index(max(l))
	if id not in d.keys():
		d[id] = 1
	else:
		d[id] += 1
mx = max(d.values())
ans = 1000000
for i in d.keys():
	if d[i] == mx:
		ans = min(ans, i + 1)
print(ans)


(n, m) = map(int, input().split())
f = []
for k in range(m):
	f.append(list(map(int, input().split())))
p = []
for j in f:
	p.append(j.index(max(j)) + 1)
g = list(set(p))
g.sort()
y = []
for i in g:
	y.append(p.count(i))
print(g[y.index(max(y))])


(n, m) = map(int, input().split())
candi = []
for i in range(m):
	k = list(map(int, input().split()))
	maxi = max(k)
	ind = k.index(maxi)
	candi.append(ind)
a = set(candi)
max = 0
val = 0
for i in a:
	p = candi.count(i)
	if p > max:
		max = p
		val = i
	elif p == max:
		if i < val:
			val = i
print(val + 1)


(n, m) = map(int, input().rstrip().split(' '))
r = [0] * n
while m:
	l = list(map(int, input().rstrip().split(' ')))
	r[l.index(max(l))] += 1
	m -= 1
print(r.index(max(r)) + 1)


(n, m) = map(int, input().split())
l = [0] * n
for i in range(m):
	k = input().split()
	k = [int(j) for j in k]
	l[k.index(max(k))] += 1
print(l.index(max(l)) + 1)


(n, m) = map(int, input().split(' '))
a = []
for i in range(m):
	a.append(list(map(int, input().split(' '))))
v = [0] * n
for aa in a:
	v[aa.index(max(aa))] += 1
print(v.index(max(v)) + 1)


nm = list(map(int, input().strip().split()))
n = nm[0]
m = nm[1]
lst = [0] * n
for i in range(m):
	lst1 = list(map(int, input().strip().split()))
	ind = lst1.index(max(lst1))
	lst[ind] += 1
print(lst.index(max(lst)) + 1)


(candidates, cities) = list(map(int, input().split()))
dd = [0] * candidates
for i in range(cities):
	a = list(map(int, input().split()))
	t = max(enumerate(a), key=lambda x: x[1])[0]
	dd[t] += 1
r = max(enumerate(dd), key=lambda x: x[1])[0]
print(r + 1)


(n, m) = map(int, input().split())
win = [0] * n
for i in range(m):
	cand = [int(i) for i in input().split()]
	win[cand.index(max(cand))] += 1
print(win.index(max(win)) + 1)


(n, m) = map(int, input().split())
t = [0] * (n + 1)
m_v_t = -1
for _ in range(m):
	m_i_c = -1
	m_v_c = -1
	l_v = list(map(int, input().split()))
	for i in range(1, n + 1):
		if l_v[i - 1] > m_v_c:
			m_i_c = i
			m_v_c = l_v[i - 1]
	t[m_i_c] += 1
	if t[m_i_c] > m_v_t:
		m_v_t = t[m_i_c]
for i in range(len(t)):
	if t[i] == m_v_t:
		print(i)
		quit()


(n, m) = map(int, input().split())
M = []
for _ in range(m):
	M.append(list(map(int, input().split())))
v = [0] * n
for i in M:
	pos = i.index(max(i))
	v[pos] += 1
print(v.index(max(v)) + 1)


(n, m) = list(map(int, input().split()))
won = [0] * n
vot = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
	ma = max(vot[i])
	for j in range(n):
		if vot[i][j] == ma:
			won[j] += 1
			break
ma = max(won)
for i in range(n):
	if ma == won[i]:
		print(i + 1)
		exit(0)


(n, m) = map(int, input().split())
s = [0] * n
for _ in range(m):
	v = list(map(int, input().split()))
	w = v.index(max(v))
	s[w] += 1
print(s.index(max(s)) + 1)


(n, m) = input().split(' ')
cands = [0] * int(n)
for x in range(int(m)):
	lstcity = list(map(int, input().split(' ')))
	ind = lstcity.index(max(lstcity))
	cands[ind] += 1
print(cands.index(max(cands)) + 1)


from operator import itemgetter
from collections import Counter
(n, m) = map(int, input().split())
v = (list(map(int, input().split())) for _ in range(m))
w = (max(enumerate(a), key=itemgetter(1))[0] for a in v)
print(max(sorted(Counter(w).items()), key=itemgetter(1))[0] + 1)


def list(l):
	d = []
	for i in range(len(l)):
		d.append(int(l[i]))
	return d
l = input()
l = l.split()
n = int(l[0])
m = int(l[1])
s = []
for k in range(n):
	s.append(0)
for i in range(m):
	a = list(input().split())
	j = a.index(max(a))
	s[j] += 1
print(s.index(max(s)) + 1)


st = [int(i) for i in input().split(' ')]
n = st[0]
m = st[1]
s = []
k = []
k1 = []
f = []
for i in range(m):
	a = [int(n) for n in input().split(' ')]
	s.append(a.index(max(a)) + 1)
for i in range(len(s)):
	if k.count(s[i]) == 0:
		k.append(s[i])
for i in range(len(k)):
	k1.append(s.count(k[i]))
if k1.count(max(k1)) == 1:
	print(k[k1.index(max(k1))])
else:
	for i in range(len(k)):
		if k1[i] == max(k1):
			f.append(k[i])
	print(min(f))


(n, m) = list(map(int, input().split()))
Max = 0
n1 = []
ind = 0
for i in range(n):
	n1.append(0)
for i in range(m):
	a = list(map(int, input().split()))
	Max = -1
	ind = 0
	for g in range(n):
		if a[g] > Max:
			ind = g
			Max = a[g]
	n1[ind] += 1
Max = 0
for i in range(n):
	if n1[i] > Max:
		ind = i + 1
		Max = n1[i]
print(ind)


from collections import OrderedDict
NandM = input().split(' ')
JandI = []
i = 0
while i < int(NandM[1]):
	JandI.append(input().split(' '))
	i += 1
winner = 0
winners = []
i = 0
m = 0
dictJandI = {}
while i < len(JandI):
	while m < len(JandI[i]):
		dictJandI[m + 1] = int(JandI[i][m])
		m += 1
	mWinner = OrderedDict(sorted(dictJandI.items(), key=lambda x: x[1], reverse=True))
	winners.append(list(mWinner.items())[0])
	m = 0
	i += 1
dictActualWinner = {}
i = 0
while i < int(NandM[1]):
	if winners[i][0] in dictActualWinner:
		dictActualWinner[winners[i][0]] += 1
	else:
		dictActualWinner[winners[i][0]] = 1
	i += 1
reallyActualWinner = OrderedDict(sorted(dictActualWinner.items(), key=lambda x: x[1], reverse=True))
print(list(reallyActualWinner.items())[0][0])


def wi(a):
	(vi, vv) = (-1, -1)
	for (ai, av) in enumerate(a):
		if av > vv:
			(vi, vv) = (ai, av)
	return vi
(n, m) = map(int, input().split())
c = [0] * n
for j in range(m):
	c[wi(list(map(int, input().split())))] += 1
print(wi(c) + 1)


(n_candidatos, n_ciudades) = map(int, input().split(' '))
matriz = []
matrizb = [[0] * n_candidatos for i in range(n_ciudades)]
for i in range(n_ciudades):
	matriz.append(list(map(int, input().split(' '))))
for i in range(n_ciudades):
	fila = matriz[i]
	ifila = fila.index(max(fila))
	matrizb[i][ifila] = 1
final = []
for j in range(n_candidatos):
	suma_col = 0
	for i in range(n_ciudades):
		suma_col += matrizb[i][j]
	final.append(suma_col)
print(1 + final.index(max(final)))


(n, m) = list(map(int, input().split()))
a = []
for i in range(m):
	a.append(list(map(int, input().split())))
won = [0] * n
for i in range(m):
	mai = 0
	for j in range(n):
		if a[i][j] > a[i][mai]:
			mai = j
	won[mai] += 1
maxx = 0
for i in range(n):
	if won[i] > won[maxx]:
		maxx = i
print(maxx + 1)


(n, m) = input().split()
(n, m) = (int(n), int(m))
s = [0] * n
for i in range(m):
	l = list(map(int, input().split()))
	x = max(l)
	s[l.index(x)] += 1
print(s.index(max(s)) + 1)


(n, m) = map(int, input().split())
l = []
for i in range(m):
	temp = list(map(int, input().split()))
	a = temp[0]
	b = 1
	for j in range(n):
		if temp[j] > a:
			a = temp[j]
			b = j + 1
	l.append(b)
c = l.count(1)
d = 1
for i in range(n):
	if l.count(i + 1) > c:
		c = l.count(i + 1)
		d = i + 1
print(d)


import itertools as it
import functools
import operator
import collections
import math
import sys

def select_candidate(xs):
	return max(enumerate(xs), key=operator.itemgetter(1))[0]

def solve(xss):
	first_round = [select_candidate(xs) for xs in xss]
	second_round = max(collections.Counter(first_round).items(), key=operator.itemgetter(1))[0]
	return second_round + 1

def print_stderr(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def main():
	[n, m] = [int(i) for i in input().strip().split()]
	xss = [[int(i) for i in input().strip().split()] for _ in range(m)]
	assert len(xss[0]) == n
	result = solve(xss)
	print(result)
main()


import sys

def get_max(elements: list) -> int:
	maximum = elements[0]
	for (i, val) in enumerate(elements):
		if maximum < val:
			maximum = val
	return maximum

def get_winner(votes: list) -> int:
	maximum = get_max(votes)
	return votes.index(maximum)
nm = input().split()
candidates_count = int(nm[0])
cities_count = int(nm[1])
if candidates_count < 1:
	sys.exit('-1')
if cities_count < 1 and cities_count > 100:
	sys.exit('-1')
candidate_votes = [0 for i in range(candidates_count)]
for i in range(0, cities_count):
	votes = input().split()
	for (j, vote) in enumerate(votes):
		votes[j] = int(vote)
	winner = get_winner(votes)
	candidate_votes[winner] += 1
winner = get_winner(candidate_votes)
print(winner + 1)


from collections import defaultdict
(n, m) = list(map(int, input().split()))
results = defaultdict(int)
for city in range(m):
	row = list(map(int, input().split()))
	winner_in_city = row.index(max(row))
	results[winner_in_city] += 1
max_votes = max(results.values())
results = filter(lambda x: x[1] == max_votes, results.items())
print(min((x[0] for x in results)) + 1)


(n, m) = list(map(int, input().split()))
b = []
for _ in range(m):
	a = list(map(int, input().split()))
	k = 0
	for i in range(1, n):
		if a[i] > a[k]:
			k = i
	b.append(k + 1)
b.sort()
(t, k) = (0, 0)
for i in range(0, m):
	j = i + 1
	while j < m and b[j] == b[i]:
		j += 1
	if j - i > t:
		t = j - i
		k = b[i]
	i = j
print(k)


abc = input().split()
n = int(abc[0])
m = int(abc[1])
a = []
for i in range(n):
	a.append(0)
for i in range(m):
	curmax = 0
	abc = input().split()
	for j in range(n):
		if int(abc[j]) > int(abc[curmax]):
			curmax = j
	a[curmax] += 1
arj = 0
for i in range(n):
	if a[i] > a[arj]:
		arj = i
print(arj + 1)


(can, city) = map(int, input().split())
l = []
for i in range(can):
	l.append(0)
for i in range(city):
	x = [int(x) for x in input().split()]
	a = x.index(max(x))
	l[a] = l[a] + 1
print(l.index(max(l)) + 1)


(n, m) = map(int, input().split())
d = []
for i in range(m):
	(c, r) = (-1, 0)
	s = [int(i) for i in input().split()]
	for i in range(n):
		if s[i] > c:
			r = i + 1
			c = s[i]
	d.append(r)
r = [0 for i in range(n)]
for i in d:
	r[i - 1] += 1
print(r.index(max(r)) + 1)


a = input()
a = a.split()
n = int(a[0])
m = int(a[1])
p = []
for i in range(n):
	p.append(0)
for i in range(m):
	st = input()
	st = st.split()
	for j in range(n):
		st[j] = int(st[j])
	m = max(st)
	k = 0
	for j in range(n):
		if m == st[j]:
			k = j
			break
	p[k] += 1
m = max(p)
for i in range(n):
	if m == p[i]:
		k = i
		break
print(k + 1)


(n, m) = map(int, input().split(' '))
s = []
while m:
	l = list(map(int, input().split(' ')))
	for i in range(len(l)):
		if l[i] == max(l):
			s.append(i)
			break
	m -= 1
s2 = []
s3 = set(s)
s3 = list(s3)
for i in s3:
	s2.append(s.count(i))
for i in s3:
	if s.count(i) == max(s2):
		print(i + 1)
		break


def winner(votes):
	result = 0
	for i in range(1, len(votes)):
		if votes[i] > votes[result]:
			result = i
	return result
(n, m) = (int(i) for i in input().split())
city_votes = [0] * n
for i in range(m):
	city_votes[winner([int(j) for j in input().split()])] += 1
print(winner(city_votes) + 1)


x = input().split()
n = int(x[0])
m = int(x[1])
candidates = [0] * (n + 1)
cities = [0] * (m + 1)
for i in range(0, m):
	x = list(map(int, input().split()))
	mx = max(x)
	for j in range(0, n):
		if x[j] == mx:
			candidates[j] += 1
			break
mx = max(candidates)
for i in range(0, n):
	if candidates[i] == mx:
		print(i + 1)
		break


[n, m] = [int(i) for i in input().split()]
arr = []
for i in range(m):
	a = [int(i) for i in input().split()]
	arr.append(a)
city_win = []
for x in range(m):
	maxi = -2
	win = -2
	for y in range(n):
		if arr[x][y] > maxi:
			maxi = arr[x][y]
			win = y
	city_win.append(win)
final_win = []
for e in range(n):
	final_win.append([e, 0])
for f in range(m):
	final_win[city_win[f]][1] += 1
max_win = -2
winner = -2
for g in range(n):
	if final_win[g][1] > max_win:
		max_win = final_win[g][1]
		winner = final_win[g][0]
print(winner + 1)


(n, m) = map(int, input().split())
res = []
for _ in range(m):
	ls = list(map(int, input().split()))
	mlsi = ls.index(max(ls))
	res.append(mlsi)
resCit = [0] * (max(res) + 1)
for r in res:
	resCit[r] += 1
print(resCit.index(max(resCit)) + 1)


(n, m) = map(int, input().split(' '))
a = list()
b = list()
c = [0] * (n + 1)
for i in range(0, m):
	a = list(map(int, input().split(' ')))
	k = max(a)
	if a.count(k) == 1:
		b.append(a.index(k) + 1)
		c[a.index(k) + 1] = c[a.index(k) + 1] + 1
	else:
		for j in range(0, n):
			if a[j] == k:
				b.append(j + 1)
				c[j + 1] = c[j + 1] + 1
				break
s = max(c)
print(c.index(s))


(n, m) = map(int, input().split())
M = [list(map(int, input().split())) for i in range(m)]
S = [0 for i in range(n)]
for i in range(m):
	ma = 0
	p = 0
	for j in range(n):
		if M[i][j] > ma:
			ma = M[i][j]
			p = j
	S[p] = S[p] + 1
ma = 0
for i in range(n):
	if ma < S[i]:
		ma = S[i]
		p = i + 1
print(p)


from collections import Counter
from operator import itemgetter

def main():
	(n, m) = list(map(int, input().split()))
	cities = [list(map(int, input().split())) for _ in range(m)]
	winners = Counter((max(enumerate(c), key=itemgetter(1))[0] + 1 for c in cities))
	winner = max(winners.items(), key=itemgetter(1))
	winner = min((w for w in winners.items() if w[0] == winner[0]), key=itemgetter(0))
	print(winner[0])
main()


from collections import Counter
(a, b) = map(int, input().split())
r = lambda : list(map(int, input().split()))
arr = [r() for _ in range(b)]
city = [0] * b
for (x, i) in enumerate(arr):
	city[x] = i.index(max(i)) + 1
brr = [city.count(i) for i in range(1, a + 1)]
print(brr.index(max(brr)) + 1)


inp = input().split()
n = int(inp[0])
m = int(inp[1])
cand = [0 for i in range(n)]
for i in range(m):
	elec = input().split()
	intv = [int(i) for i in elec]
	maximum = max(intv)
	winner = intv.index(maximum)
	cand[winner] += 1
maximum = max(cand)
winner = cand.index(maximum) + 1
print(winner)


(n, m) = map(int, input().split())
(l, t1) = ([], {i: 0 for i in range(105)})
for _ in range(m):
	l1 = list(map(int, input().split()))
	l.append(l1)
	tp = max(l1)
	ls = l1.index(tp)
	if ls not in t1:
		t1[ls] = 1
	else:
		t1[ls] += 1
res = 0
for i in range(1, n + 1):
	if t1[res] < t1[i]:
		res = i
print(res + 1)


t = input().split(' ')
guys = [0] * int(t[0])
cities = int(t[1])
for i in range(cities):
	res = input().split(' ')
	max_val = -1
	pos = -1
	for j in range(len(res)):
		val = int(res[j])
		if val > max_val:
			pos = j
			max_val = val
	guys[pos] += 1
pos = -1
max_val = -1
for i in range(len(guys)):
	if guys[i] > max_val:
		max_val = guys[i]
		pos = i
print(pos + 1)


(n, m) = [int(s) for s in input().split()]
votes = [0] * n
for i in range(m):
	city = [int(s) for s in input().split()]
	candidate = city.index(max(city))
	votes[candidate] += 1
print(votes.index(max(votes)) + 1)


(n, m) = map(int, input().split())
ans = [0] * n
for i in range(m):
	line = input().split()
	line = [int(i) for i in line]
	ans[line.index(max(line))] += 1
print(ans.index(max(ans)) + 1)


(n, m) = map(int, input().split())
a = []
answ = []
for i in range(m):
	answ.append([])
for i in range(m):
	a.append([])
for i in range(m):
	a[i] = list(map(int, input().split()))
for i in range(m):
	v = a[i]
	mn = max(v)
	k = 0
	for j in reversed(range(n)):
		if a[i][j] == mn:
			k = j
	answ[i] = k
answ_k = []
for i in range(n):
	answ_k.append(0)
for i in range(len(answ)):
	answ_k[answ[i]] += 1
mn = max(answ_k)
for i in range(n):
	if answ_k[i] == mn:
		print(i + 1)
		exit()


import math, fractions
(n, m) = [int(x) for x in input().split()]
q = [0] * n
for _ in range(m):
	temp = [int(x) for x in input().split()]
	q[temp.index(max(temp))] += 1
print(q.index(max(q)) + 1)


firstLine = [int(n) for n in input().split()]
candidates = firstLine[0]
cities = firstLine[1]
citiesWon = [0] * candidates
for i in range(0, cities):
	votes = [int(n) for n in input().split()]
	j = 0
	winnerIndex = -1
	while j < len(votes):
		if winnerIndex == -1 or votes[j] > votes[winnerIndex]:
			winnerIndex = j
		j += 1
	citiesWon[winnerIndex] += 1
j = 0
bigWinIndex = -1
while j < len(votes):
	if bigWinIndex == -1 or citiesWon[j] > citiesWon[bigWinIndex]:
		bigWinIndex = j
	j += 1
print(bigWinIndex + 1)


import sys
import os
(n, m) = list(map(int, input().split(' ')))
cands = [0] * n
for x in range(m):
	lcity = list(map(int, input().split(' ')))
	ind = lcity.index(max(lcity))
	cands[ind] += 1
print(cands.index(max(cands)) + 1)


(a, b) = input().split()
p = int(a)
b = int(b)

def inp(s):
	j = 0
	a = []
	for i in range(len(s)):
		if s[i] == ' ':
			a.append(int(s[j:i]))
			j = i + 1
		if i == len(s) - 1:
			a.append(int(s[j:]))
	return a
r = []
for i in range(b):
	s = input()
	a = inp(s)
	m = max(a)
	n = a.index(m) + 1
	r.append(n)
t = []
for i in range(1, p + 1):
	x = r.count(i)
	t.append(x)
m = max(t)
n = t.index(m) + 1
print(n)


import sys
(n, m) = [int(i) for i in input().split(' ')]
sum1 = [0 for i in range(n)]
for i in range(m):
	sum2 = [int(i) for i in input().split(' ')]
	for j in range(n):
		if sum2[j] == max(sum2):
			sum1[j] += 1
			break
for j in range(n):
	if sum1[j] == max(sum1):
		print(j + 1)
		break


(n, m) = map(int, input().split())
candidates = [0] * n
for i in range(m):
	votes = list(map(int, input().split()))
	candidates[votes.index(max(votes))] += 1
print(candidates.index(max(candidates)) + 1)


(n, m) = map(int, input().split())
d = [0] * (n + 1)
for i in range(m):
	inp = list(map(int, input().split()))
	s = inp.index(max(inp))
	d[s + 1] += 1
print(d.index(max(d)))


(n, m) = map(int, input().split())
votes = [0 for i in range(n)]
for i in range(m):
	elist = list(map(int, input().split()))
	pers = 0
	for i in range(n):
		if elist[i] > elist[pers]:
			pers = i
	votes[pers] += 1
ans = 0
for i in range(n):
	if votes[i] > votes[ans]:
		ans = i
print(ans + 1)


(n, m) = map(int, input().split())
kan = {}
for i in range(n + 1):
	kan[i] = 0
for i in range(m):
	l = list(map(int, input().split()))
	maxi = -1
	for j in range(n):
		if l[j] > maxi:
			maxi = l[j]
			ind = j + 1
	kan[ind] += 1
maxi = 0
for i in range(1, n + 1):
	if kan[i] > maxi:
		maxi = kan[i]
		ans = i
print(ans)


(n, c) = map(int, input().split())
score = [0] * n
for _ in range(c):
	city = list(map(int, input().split()))
	score[city.index(max(city))] += 1
print(score.index(max(score)) + 1)


(n, m) = map(int, input().split())
count = [0] * n
for i in range(m):
	vote = list(map(int, input().split()))
	count[vote.index(max(vote))] += 1
print(count.index(max(count)) + 1)


(n, m) = list(map(int, input().split()))
b = []
for _ in range(m):
	a = list(map(int, input().split()))
	b.append(a.index(max(a)) + 1)
d = {}
for i in range(1, n + 1):
	d[i] = b.count(i)
s = set(b)
c = []
for i in s:
	c.append(b.count(i))
for i in d:
	if d[i] == max(c):
		print(i)
		break


(n, m) = map(int, input().split(' '))
A = []
B = []
for i in range(m):
	X = [int(p) for p in input().split(' ')]
	x = []
	for i in range(len(X)):
		if X[i] == max(X):
			x.append(i + 1)
	A.append(min(x))
	B.append(X[min(x) - 1])
c = []
for j in range(n):
	if A.count(j + 1) > 0:
		c.append(A.count(j + 1))
v = []
for j in range(n):
	if max(c) == A.count(j + 1):
		v.append(j + 1)
print(min(v))


(n, m) = map(int, input().split())
l = []
for i in range(m):
	z = list(map(int, input().split()))
	l.append(z.index(max(z)) + 1)
k = set(l)
cnt = 0
cnt1 = 0
for j in k:
	if l.count(j) > cnt:
		cnt = l.count(j)
		cnt1 = j
print(cnt1)


(n, m) = map(int, input().split(' '))
L1 = [0] * n
for k in range(m):
	L = list(map(int, input().split(' ')))
	L1[L.index(max(L))] += 1
print(L1.index(max(L1)) + 1)


(n, m) = [int(x) for x in input().split()]
candidatesWin = []
for i in range(0, n + 1):
	candidatesWin.append(0)
for i in range(0, m):
	votes = [int(x) for x in input().split()]
	maxVote = max(votes)
	for j in range(0, n):
		if votes[j] == maxVote:
			candidatesWin[j + 1] += 1
			break
maxWin = max(candidatesWin)
for i in range(1, n + 1):
	if candidatesWin[i] == maxWin:
		print(i)
		break


(n, m) = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
c = [0] * n
for i in range(m):
	mx = max(a[i])
	for j in range(n):
		if a[i][j] == mx:
			c[j] += 1
			break
mx = max(c)
for i in range(n):
	if mx == c[i]:
		print(i + 1)
		break


(n, m) = map(int, input().split())
winnerList = []
for i in range(m):
	a = list(map(int, input().split()))
	large = a[0]
	pos = 0
	for j in range(n):
		if large < a[j]:
			large = a[j]
			pos = j
	winnerList.append(pos + 1)
winnerCount = dict()
for j in winnerList:
	winnerCount[j] = 0
for j in winnerList:
	winnerCount[j] += 1
large = 0
key = 0
for j in winnerCount:
	if large < winnerCount[j]:
		large = winnerCount[j]
		key = j
print(key)


s = input()
l = []
l = s.split()
n = int(l[0])
k = int(l[1])
d = []
m2 = []
for i in range(0, k):
	s1 = input()
	h1 = []
	h1 = s1.split()
	for i in range(0, len(h1)):
		h1[i] = int(h1[i])
	m2.append(h1.index(max(h1)) + 1)
res = max(set(m2), key=m2.count)
print(res)


import io
import math
a = list(map(int, input().split()))
ind = 0
max1 = 0
kol = 1
kol1 = 1
n = a[0]
m = a[1]
massive = []
mas2 = {1: 2, 2: 3}
mas1 = []
for i in range(m):
	massive.append(list(map(int, input().split())))
	mas1.append(massive[i].index(max(massive[i])) + 1)
kol = len(mas1)
mas1.sort()
if m != 1:
	for i in range(kol - 1):
		while i < kol - 1 and mas1[i] == mas1[i + 1]:
			kol1 += 1
			i += 1
		if kol1 > max1:
			max1 = kol1
			ind = mas1[i - 1 if i > 0 else i]
		kol1 = 1
	print(ind)
else:
	print(massive[0].index(max(massive[0])) + 1)


(n, m) = [int(x) for x in input().split()]
v = [0] * n
for i in range(m):
	l = [int(x) for x in input().split()]
	v[l.index(max(l))] += 1
print(v.index(max(v)) + 1)


(n, m) = map(int, input().split())
List = []
for i in range(m):
	temp = list(map(int, input().split()))
	List.append(temp)
candidate = [0 for i in range(n)]
for i in range(m):
	max = List[i][0]
	id = 0
	for j in range(1, n):
		if max < List[i][j]:
			max = List[i][j]
			id = j
	candidate[id] += 1
id = 0
max = candidate[0]
for i in range(n):
	if max < candidate[i]:
		max = candidate[i]
		id = i
print(id + 1)


(n, m) = map(int, input().split())
res = [0] * n
for i in range(m):
	a = list(map(int, input().split()))
	m = max(a)
	for j in range(n):
		if a[j] == m:
			res[j] += 1
			break
m = max(res)
for i in range(n):
	if res[i] == m:
		print(i + 1)
		break


(n, m) = map(int, input().split())
c = []
for i in range(m):
	a = list(map(int, input().split()))
	m = max(a)
	ind = a.index(m)
	c.append(ind + 1)
w = []
for i in range(1, n + 1):
	w.append(c.count(i))
m1 = max(w)
ind1 = w.index(m1)
print(ind1 + 1)


(n, m) = map(int, input().split())
vote = [0] * n
for i in range(m):
	votes = list(map(int, input().split()))
	maxV = 0
	for j in range(n):
		if votes[j] > votes[maxV]:
			maxV = j
	vote[maxV] += 1
maxV = 0
for j in range(n):
	if vote[j] > vote[maxV]:
		maxV = j
print(maxV + 1)


(n, q) = map(int, input().split())
ans = [0] * n
while q:
	q -= 1
	ls = list(map(int, input().split()))
	x = max(ls)
	x = ls.index(x)
	ans[x] += 1
x = max(ans)
x = ans.index(x)
print(x + 1)


from statistics import *
(n, m) = map(int, input().split())
li = [0] * 150
for i in range(m):
	x = list(map(int, input().split()))
	mx = max(x)
	for j in range(n):
		if x[j] == mx:
			li[j + 1] += 1
			break
mxx = max(li)
for i in range(1, 101):
	if li[i] == mxx:
		print(i)
		break


params = input().split(' ')
n = int(params[0])
m = int(params[1])
cityRes = dict()
for i in range(m):
	cityS = input().split(' ')
	maxV = 0
	inR = 0
	for i in range(n):
		if int(cityS[i]) > maxV:
			inR = i
			maxV = int(cityS[i])
	if inR in cityRes.keys():
		cityRes[inR] += 1
	else:
		cityRes[inR] = 1
maxV = 0
inR = 0
for i in sorted(cityRes.keys()):
	if cityRes[i] > maxV:
		inR = i
		maxV = cityRes[i]
print(str(inR + 1))


[n, m] = map(int, input().split())
a = list()
sl = [0] * n
for _ in range(0, m):
	a.append(list(map(int, input().split())))
for i in range(0, m):
	mi = -1
	mx = -1
	for j in range(0, n):
		if mx < a[i][j]:
			mi = j
			mx = a[i][j]
	sl[mi] += 1
res = -1
resmx = -1
for (i, v) in enumerate(sl):
	if resmx < v:
		resmx = v
		res = i + 1
print(res)


(n, m) = [int(i) for i in input().split()]
fq = [0] * (n + 1)
for i in range(m):
	city = [int(i) for i in input().split()]
	fq[city.index(max(city)) + 1] += 1
print(fq.index(max(fq)))


(x, y) = [int(x) for x in input().split()]
c = [0] * x
for i in range(y):
	z = [int(a) for a in input().split()]
	a = z.index(max(z))
	c[a] = c[a] + 1
print(c.index(max(c)) + 1)


def determine_winner(cities_data):
	cities_winners = []
	winners = []
	for i in range(len(cities_data)):
		max_votes = 0
		for j in range(len(cities_data[i])):
			if cities_data[i][j] >= max_votes:
				max_votes = cities_data[i][j]
		for z in range(len(cities_data[i])):
			if cities_data[i][z] == max_votes:
				winners.append(z)
				break
	return max(set(winners), key=winners.count) + 1

def convert_into_int(arr):
	for i in range(len(arr)):
		arr[i] = int(arr[i])
	return arr
inputs_nums = input().split(' ')
inputs_nums = convert_into_int(inputs_nums)
inputs_data = []
for i in range(inputs_nums[1]):
	input_data = input().split(' ')
	input_data = convert_into_int(input_data)
	inputs_data.append(input_data)
print(determine_winner(inputs_data))


(a, b) = map(int, input().split())
arr = [0] * 102
h = 0
while b:
	b -= 1
	l = list(map(int, input().split()))
	h = max(l)
	arr[l.index(h)] += 1
print(arr.index(max(arr)) + 1)


import collections
(n, m) = map(int, input().split())
arr = []
for __ in range(m):
	ar = list(map(int, input().split()))
	arr.append(ar)
ar = {}
for i in range(m):
	m = max(arr[i])
	for j in range(n):
		if arr[i][j] == m:
			try:
				ar[j + 1] += 1
			except:
				ar[j + 1] = 1
			break
m = max(ar.values())
ar = collections.OrderedDict(sorted(ar.items()))
for (k, v) in ar.items():
	if ar[k] == m:
		print(k)
		break


(a, b) = list((int(x) for x in input().split()))
citiesWon = []
es = []
for _ in range(a):
	citiesWon.append(0)
for _ in range(b):
	es.append(list((int(x) for x in input().split())))
for i in es:
	t = i.index(max(i))
	citiesWon[t] += 1
print(citiesWon.index(max(citiesWon)) + 1)


def main():
	(n, m) = map(int, input().split())
	candidates = [0 for _ in range(n + 1)]
	for _ in range(m):
		arr = list(map(int, input().split()))
		temp = -1
		mx = -1
		for i in range(n):
			if mx < arr[i]:
				mx = arr[i]
				temp = i + 1
		candidates[temp] += 1
	temp = -1
	mx = -1
	for i in range(n + 1):
		if mx < candidates[i]:
			mx = candidates[i]
			temp = i
	print(temp)
main()


(n, m) = [int(i) for i in input().split()]
votes = [0] * n
for i in range(m):
	currVotes = [int(i) for i in input().split()]
	maxIndex = 0
	for j in range(len(currVotes)):
		if currVotes[maxIndex] < currVotes[j]:
			maxIndex = j
	votes[maxIndex] += 1
maxIndex = 0
for i in range(len(votes)):
	if votes[maxIndex] < votes[i]:
		maxIndex = i
print(maxIndex + 1)


nm = input().split()
g = []
for i in range(int(nm[1])):
	m = 0
	k = 0
	s = input().split()
	for j in range(int(nm[0])):
		if int(s[j]) > m:
			m = int(s[j])
			k = j
	g.append(k)
h = list((0 for i in range(int(nm[0]))))
for i in g:
	h[i] += 1
k = 0
l = 0
for i in range(int(nm[0])):
	if h[i] > l:
		l = h[i]
		k = i
print(k + 1)


import sys
x = str(input()).split()
n = int(x[0])
m = int(x[1])
cit = [0] * m
for i in range(m):
	x = str(input()).split()
	max_cand = 0
	cand = 1
	for j in range(n):
		if int(x[j]) > max_cand:
			cand = j + 1
			max_cand = int(x[j])
	cit[i] = cand
max = 0
win = 1
for i in range(1, n + 1):
	now = 0
	for j in range(m):
		if i == cit[j]:
			now += 1
	if now > max:
		win = i
		max = now
print(win)


(n, m) = map(int, input().split())
c = [0 for _ in range(n)]
for _ in range(m):
	t = list(map(int, input().split()))
	c[t.index(max(t))] += 1
print(c.index(max(c)) + 1)


lineInput = list(map(int, str(input()).split()))
m = lineInput[0]
n = lineInput[1]
city = [0] * 110
for i in range(0, n):
	cnt = list(map(int, str(input()).split()))
	winner = 0
	for j in range(0, m):
		if cnt[j] > cnt[winner]:
			winner = j
	city[winner] += 1
answer = int(0)
for i in range(0, m):
	if city[i] > city[answer]:
		answer = i
answer += 1
print(answer)


(n, m) = map(int, input().split())
votes = [0] * n
for i in range(m):
	row = list(map(int, input().split()))
	rowmax = max(row)
	votes[row.index(rowmax)] += 1
votmax = max(votes)
print(votes.index(votmax) + 1)


def won(l):
	l = list(l)
	return l.index(max(l))

def readline():
	return (int(i) for i in input().split())
(n, m) = readline()
first_winners = (won(readline()) for i in range(m))
a = [0] * n
for i in first_winners:
	a[i] += 1
print(won(a) + 1)


(n, m) = map(int, input().split())
a = [[int(x) for x in input().split()] for _ in range(m)]
c = [0] * n
for x in a:
	c[x.index(max(x))] += 1
print(c.index(max(c)) + 1)


def get_winner(results, cand_n):
	current_winner = (0, 0)
	for index_cand in range(cand_n):
		if current_winner[1] < results[index_cand]:
			current_winner = (index_cand, results[index_cand])
	return current_winner
(cand, cities) = [int(x) for x in input().split(' ')]
wins = [0] * cand
for index_city in range(cities):
	res = [int(x) for x in input().split(' ')]
	wins[get_winner(res, cand)[0]] += 1
print(get_winner(wins, cand)[0] + 1)


(n, m) = list(map(int, input().split(' ')))
c = []
for i in range(m):
	c.append(list(map(int, input().split(' '))))
d = []
for i in range(n):
	d.append(0)
for i in c:
	d[i.index(max(i))] += 1
print(d.index(max(d)) + 1)


(n, m) = map(int, input().split())
d = {}
for i in range(m):
	x = list(map(int, input().split()))
	c = max(x)
	ind = 0
	for i in range(n):
		if x[i] == c:
			ind = i
			break
	if ind not in d:
		d[ind] = 1
	else:
		d[ind] += 1
ans = int(1000000000.0)
t = 0
t = max(d.values())
for i in d:
	if d[i] == t and i < ans:
		ans = i
print(ans + 1)


(n, m) = map(int, input().split())
a = [[0, 0, i] for i in range(n)]
for i in range(m):
	b = list(map(int, input().split()))
	ma = -1
	maxind = 0
	for j in range(n):
		if b[j] > ma:
			ma = b[j]
			maxind = j
		a[j][1] += b[j]
	a[maxind][0] += 1
a.sort(key=lambda x: (-x[0], x[2], x[1]))
print(a[0][2] + 1)


(n, m) = map(int, input().split())
b = [0] * (n + 1)
for i in range(m):
	a = list(map(int, input().split()))
	mx = -1
	index = -1
	for j in range(n):
		if a[j] > mx:
			mx = a[j]
			index = j
	b[index] += 1
mx = -1
index = -1
for i in range(n):
	if b[i] > mx:
		mx = b[i]
		index = i
print(index + 1)


(n, c) = [int(x) for x in input().split()]
a = []
b = []
for i in range(c):
	b = [int(x) for x in input().split()]
	a.append(b)
f = [0] * n
for i in range(c):
	maxpos = a[i].index(max(a[i]))
	f[maxpos] += 1
print(f.index(max(f)) + 1)


(candidates, cities) = map(int, input().split())
winnercandidates = [0] * 200
for i in range(cities):
	votes = list(map(int, input().split()))
	mx = max(votes)
	for j in range(candidates):
		if votes[j] == mx:
			winnercandidates[j] += 1
			break
mx = max(winnercandidates)
for i in range(200):
	if winnercandidates[i] == mx:
		print(i + 1)
		break


(n, m) = map(int, input().split())
list1 = [0] * n
for i in range(m):
	list2 = [*map(int, input().split())]
	list1[list2.index(max(list2))] += 1
print(list1.index(max(list1)) + 1)


(n, m) = map(int, input().split())
A = []
for i in range(m):
	A.append(list(map(int, input().split())))
one = [0] * m
for i in range(0, m):
	x = 0
	c = 0
	for j in range(0, n):
		if A[i][j] > x:
			x = A[i][j]
			c = j
			one[i] = c
x = 0
j = 0
two = [0] * n
for i in range(0, m):
	two[one[i]] += 1
for i in range(0, n):
	if two[i] > x:
		x = two[i]
		j = i
print(j + 1)


(num_candidates, num_cities) = map(int, input().split())
candidate_wins = [0 for i in range(num_candidates)]
for i in range(num_cities):
	votes = enumerate(map(int, input().split()))
	votes = sorted(((-value, index) for (index, value) in votes))
	candidate_wins[votes[0][1]] += 1
candidates = sorted(((-wins, index) for (index, wins) in enumerate(candidate_wins)))
print(candidates[0][1] + 1)


(n, m) = map(int, input().split())
winner = []
for _ in range(m):
	res = list(map(int, input().split()))
	m = max(res)
	winner.append(res.index(m) + 1)
from collections import defaultdict
d = defaultdict(int)
winner.sort()
a = 0
res = 0
for w in winner:
	d[w] += 1
	if d[w] > res:
		res = d[w]
		a = w
print(a)


def elections(n, m, array):
	results = [0] * n
	for c in array:
		results[c.index(max(c))] += 1
	return results.index(max(results)) + 1
(n, m) = list(map(int, input().split(' ')))
array = []
for i in range(m):
	array.append(list(map(int, input().split(' '))))
print(elections(n, m, array))


a = input().split()
a = list(map(int, a))
n = a[0]
m = a[1]
wotes = [0] * n
for q in range(m):
	a = input().split()
	a = list(map(int, a))
	winner = -1
	mx = -1
	for j in range(n):
		if a[j] > mx:
			mx = a[j]
			winner = j
	wotes[winner] += 1
winner = -1
mx = -1
for j in range(n):
	if wotes[j] > mx:
		mx = wotes[j]
		winner = j
print(winner + 1)


(n, m) = map(int, input().split())
grid = (list(map(int, input().split())) for _ in range(m))
maxx = (max(range(n), key=row.__getitem__) for row in grid)
from collections import Counter
cnts = Counter(maxx)
ans = max(cnts.keys(), key=cnts.__getitem__) + 1
print(ans)


(n, m) = input().split()
(n, m) = (int(n), int(m))
B = []
for i in range(0, m):
	A = []
	a = input()
	for j in a.split():
		A.append(int(j))
	b = max(A)
	c = A.index(b)
	B.append(c + 1)
count = 1
Max = 1
B.sort()
x = B[0]
for j in range(0, m - 1):
	if B[j + 1] == B[j]:
		count = count + 1
		if count > Max:
			Max = count
			x = B[j]
	else:
		count = 1
print(x)


from collections import defaultdict
(n, m) = [int(i) for i in input().split(' ')]
can = defaultdict(int)
for i in range(m):
	arr = [int(i) for i in input().split(' ')]
	t = 0
	for j in range(n):
		if arr[j] > arr[t]:
			t = j
	can[t] += 1
t = 0
for i in range(n):
	if can[i] > can[t]:
		t = i
print(t + 1)


(candidates, cities) = map(int, input().split())
vote_list = []
winner = []
count = {}
for i in range(cities):
	vote_input = list(map(int, input().split()))
	vote_list.append(vote_input)
for i in range(len(vote_list)):
	winner.append(vote_list[i].index(max(vote_list[i])) + 1)
winner = sorted(winner)
for i in winner:
	if i in count:
		count[i] += 1
	else:
		count[i] = 1
lst = []
for i in count.keys():
	if count[i] == max(count.values()):
		lst.append(i)
print(min(lst))


(N, M) = map(int, input().split())
a = list((list(map(int, input().split())) for i in range(M)))
c = [0] * N
for i in range(M):
	c[a[i].index(max(a[i]))] += 1
print(c.index(max(c)) + 1)


(ad, cit) = list(map(int, input().split()))
d = {}
for i in range(cit):
	l = list(map(int, input().split()))
	maxi = l[0]
	ind = 1
	for i in range(len(l)):
		if l[i] > maxi:
			maxi = l[i]
			ind = i + 1
	if not ind in d:
		d[ind] = 0
	d[ind] += 1
maxi = -1
for (adam, say) in d.items():
	if say > maxi:
		maxi = say
		qalib = adam
	elif say == maxi and qalib > adam:
		qalib = adam
print(qalib)


(n, m) = map(int, input().split(' '))
result = [0] * n
for i in range(m):
	M = -1
	l = list(map(int, input().split(' ')))
	for j in range(len(l)):
		if M < l[j]:
			M = l[j]
			winner = j
	result[winner] += 1
M = -1
for i in range(len(result)):
	if M < result[i]:
		res = i
		M = result[i]
print(res + 1)


(n, m) = map(int, input().split())
k = [0 for i in range(n)]
pre = 0
for i in range(m):
	a = list(map(int, input().split()))
	pre = 1
	for j in range(0, n):
		if a[j] > a[pre - 1]:
			pre = j + 1
	k[pre - 1] += 1
pp = 1
for i in range(0, n):
	if k[i] > k[pp - 1]:
		pp = i + 1
print(pp)


inputs = list(map(int, input().split()))
n = inputs[0]
m = inputs[1]
max_outer = [0, 0]
mx = [0 for i in range(n)]
for i in range(m):
	max_inner = [0, 0]
	votes = list(map(int, input().split()))
	for j in range(n):
		if votes[j] > max_inner[0]:
			max_inner = [votes[j], j]
	mx[max_inner[1]] += 1
for i in range(n):
	if mx[i] > max_outer[0]:
		max_outer = [mx[i], i + 1]
print(max_outer[1])


(N, M) = map(int, input().split())
bucket = [0] * N
for i in range(M):
	v = [int(x) for x in input().split()]
	bucket[v.index(max(v))] += 1
print(bucket.index(max(bucket)) + 1)


from collections import Counter
(n, m) = map(int, input().split())
l = []
for i in range(m):
	s = list(map(int, input().split()))
	l.append(s.index(max(s)) + 1)
d = Counter(l)
print(d.most_common(1)[0][0])


(n, m) = map(int, input().split())
win = [0] * 1000
for i in range(m):
	l = [int(i) for i in input().split()]
	win[l.index(max(l))] += 1
print(win.index(max(win)) + 1)


import math
import os
import random
import re
import sys
from collections import Counter
sys.setrecursionlimit(3000)

def si():
	return str(input())

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def debug(x):
	return print(x)
(n, m) = mi()
ans = []
for i in range(m):
	arr = li()
	maxv = max(arr)
	for j in range(n):
		if arr[j] == maxv:
			ans.append(j + 1)
			break
d = Counter(ans)
maxva = max(d.values())
l = []
for i in d:
	if d[i] == maxva:
		l.append(i)
print(min(l))


(n, m) = map(int, input().split())
maxi = [0] * m
for i in range(m):
	a = tuple(map(int, input().split()))
	maxi[i] = a.index(max(a))
cands = [0] * n
for elem in maxi:
	cands[elem] += 1
maxa = 0
win = -1
for i in range(n):
	if maxa < cands[i]:
		win = i
		maxa = cands[i]
print(win + 1)


(n, m) = map(int, input().split())
table = [list(map(int, input().split())) for _ in range(m)]
table2 = [0 for _ in range(n)]
for i in table:
	table2[i.index(max(i))] += 1
print(table2.index(max(table2)) + 1)


t = [int(x) for x in input().split()]
r = t[0]
e = t[1]
empty = [0] * (r + 1)
for i in range(1, e + 1):
	y = [int(x) for x in input().split()]
	empty[y.index(max(y)) + 1] += 1
print(empty.index(max(empty)))


(kandidatov, miest) = map(int, input().split())
vyhercovia = [0 for i in range(kandidatov)]
for i in range(miest):
	hlasy = list(map(int, input().split()))
	vyherca = hlasy.index(max(hlasy))
	vyhercovia[vyherca] += 1
vyherny_pocet = max(vyhercovia)
vyherca = vyhercovia.index(vyherny_pocet)
print(vyherca + 1)


(n, m) = [int(x) for x in input().split()]
L = [0] * (n + 1)
for i in range(m):
	l = [int(x) for x in input().split()]
	max = -1
	for i in range(n):
		if l[i] > max:
			maxval = i + 1
			max = l[i]
	L[maxval] += 1
max = -1
for i in range(n + 1):
	if L[i] > max:
		maxval = i
		max = L[i]
print(maxval)


(n, mm) = map(int, input().split())
l = [0] * n
for i in range(mm):
	d = list(map(int, input().split()))
	l[d.index(max(d))] += 1
print(l.index(max(l)) + 1)


__author__ = 'suvasish'
(n, m) = map(int, input().split(' '))
win_can = {}
for l in range(0, n):
	win_can[l] = 0
for i in range(0, m):
	city_votes = list(map(int, input().split(' ')))
	_index = city_votes.index(max(city_votes))
	win_can[_index] += 1
winner = 0
for key in range(1, len(win_can)):
	if win_can[key] > win_can[winner]:
		winner = key
print(winner + 1)


(n, m) = [int(i) for i in input().split()]
a = [0] * n
for i in range(m):
	cur = [int(i) for i in input().split()]
	a[cur.index(max(cur))] += 1
print(1 + a.index(max(a)))


(n, m) = map(int, input().split())
j = []
for i in range(m):
	a = list(map(int, input().split()))
	b = list(a)
	b.sort()
	h = a.index(b[n - 1]) + 1
	j.append(h)
k = 0
for i in range(1, n + 1):
	if j.count(i) > j.count(k):
		k = i
print(k)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(N, M) = map(int, input().split())
wins = collections.defaultdict(int)
for i in range(M):
	a = [int(x) for x in input().split()]
	maxa = -1
	w = -1
	for j in range(N):
		if a[j] > maxa:
			maxa = a[j]
			w = j + 1
	wins[w] += 1
maxa = -1
ans = -1
for i in sorted(wins.keys()):
	if wins[i] > maxa:
		maxa = wins[i]
		ans = i
print(ans)


(n, m) = [int(i) for i in input().split()]
a = [0] * 101
for i in range(m):
	b = [int(i) for i in input().split()]
	a[b.index(max(b))] += 1
print(a.index(max(a)) + 1)


(n, m) = map(int, input().split())
ct = [0 for i in range(n)]
a = []
for i in range(m):
	a.append(list(map(int, input().split())))
for i in range(m):
	w = -1
	maxx = -1
	for j in range(n):
		if a[i][j] > maxx:
			maxx = a[i][j]
			w = j
	ct[w] += 1
w = -1
maxx = 0
for i in range(n):
	if ct[i] > maxx:
		maxx = ct[i]
		w = i
print(w + 1)


(n, m) = map(int, input().split())
matrix = [list(map(int, input().split())) for i in range(m)]
candidates = [matrix[i].index(max(matrix[i])) for i in range(m)]
votes = {candidates[i]: candidates.count(candidates[i]) for i in range(m)}
for i in votes:
	if votes[i] == max(votes.values()):
		print(i + 1)
		quit()


read = lambda : map(int, input().split())
(n, m) = read()
a = [list(read()) for i in range(m)]
cand = [0] * n
for i in range(m):
	cand[a[i].index(max(a[i]))] += 1
print(cand.index(max(cand)) + 1)


(n, m) = map(int, input().split())
won = {}
for _ in range(m):
	votes = [int(x) for x in input().split()]
	index = -1
	maxi = -1
	for i in range(len(votes)):
		if votes[i] > maxi:
			index = i + 1
			maxi = votes[i]
	if index in won.keys():
		won[index] += 1
	else:
		won[index] = 1
index = -1
maxi = -1
for k in sorted(won.keys()):
	if won[k] > maxi:
		maxi = won[k]
		index = k
print(index)


import math, bisect, heapq, random, sys, itertools
input = sys.stdin.readline
ints = lambda : list(map(int, input().split()))
p = 10 ** 9 + 7
(n, m) = ints()
a = [0] * n
for i in range(m):
	b = ints()
	a[b.index(max(b))] += 1
print(a.index(max(a)) + 1)


s = input().split()
a = int(s[0])
b = int(s[1])
mat = []
d = {}
hooks = 0
for i in range(b):
	st = input().split()[0:a]
	for j in range(a):
		st[j] = int(st[j])
	mat.append(st.index(max(st)))
for i in mat:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
for i in d:
	if d[i] > hooks:
		hooks = d[i]
for i in d:
	if d[i] == hooks:
		print(i + 1)
		break


def main():
	(n, m) = [int(x) for x in input().split()]
	poli = [0] * n
	while m:
		inp = [int(x) for x in input().split()]
		_max = max(inp)
		poli[inp.index(_max)] += 1
		m -= 1
	print(poli.index(max(poli)) + 1)
main()


a = [0] * 100
(m, n) = list(map(int, input().split()))
ans = [0, 0]
for i in range(n):
	inp = list(map(int, input().split()))
	mx = [0, 0]
	for j in range(m):
		if inp[j] > mx[1]:
			mx = [j, inp[j]]
	a[mx[0]] += 1
	if ans[1] < a[mx[0]]:
		ans = [mx[0], a[mx[0]]]
	elif ans[1] == a[mx[0]] and ans[0] > mx[0]:
		ans = [mx[0], a[mx[0]]]
print(ans[0] + 1)
import time, sys
sys.stderr.write('{0:.3f} ms\n'.format(time.clock() * 1000))


(n, m) = map(int, input().split())
score = [0 for i in range(n)]
for i in range(m):
	a = list(map(int, input().split()))
	maximum = -1
	index = -1
	for j in range(len(a)):
		if maximum < a[j]:
			maximum = a[j]
			index = j
	score[index] += 1
maximum = -1
index = -1
for i in range(len(score)):
	if maximum < score[i]:
		maximum = score[i]
		index = i
print(index + 1)


(n, m) = map(int, input().split())
dic = [0] * n
for i in range(0, m):
	dics = [int(i) for i in input().split()]
	intdic = dics.index(max(dics))
	dic[intdic] += 1
print(dic.index(max(dic)) + 1)


def get_value():
	(candidate_count, city_count) = [int(val) for val in input().split()]
	counts = dict()
	winners = []
	for i in range(candidate_count):
		counts[str(i + 1)] = 0
	for i in range(city_count):
		votes = [int(val) for val in input().split()]
		max_vote = max(votes)
		for (j, val) in enumerate(votes):
			if val == max_vote:
				counts[str(j + 1)] += 1
				break
	max_count = max(counts.values())
	for k in counts:
		if counts[k] == max_count:
			winners.append(int(k))
	return sorted(winners)[0]
print(get_value())


from sys import stdin
live = True
if not live:
	stdin = open('data.in', 'r')
(n, m) = list(map(int, stdin.readline().strip().split()))
cand = [0] * n
for cities in range(m):
	line = list(map(int, stdin.readline().strip().split()))
	max = line[0]
	maxIndex = 0
	for jt in range(1, n):
		if line[jt] > max:
			max = line[jt]
			maxIndex = jt
	cand[maxIndex] += 1
max = cand[0]
maxIndex = 0
for it in range(1, n):
	if cand[it] > max:
		max = cand[it]
		maxIndex = it
print(maxIndex + 1)
if not live:
	stdin.close()


from collections import Counter as cnt
(n, m) = map(int, input().split())
ll = [list(map(int, input().split())) for _ in range(m)]
if n == 1:
	print(1)
else:
	l = []
	for city in ll:
		l.append(1 + city.index(max(city)))
	dic = cnt(l)
	maxvalur = dic[max(dic, key=dic.get)]
	ans = []
	for key in dic:
		if dic[key] == maxvalur:
			ans.append(key)
	print(min(ans))


from collections import Counter
(n, m) = list(map(int, input().split()))
citywon = []
l = []
for j in range(m):
	kk = list(map(int, input().split()))
	citywon.append(kk.index(max(kk)) + 1)
d = dict(Counter(citywon))
res = []
maxx = max(list(d.values()))
for i in d:
	if d[i] == maxx:
		res.append(i)
print(min(res))


(a, b) = map(int, input().split())
d = {}
for _ in range(b):
	a = list(map(int, input().split()))
	r = -1
	for i in range(len(a)):
		if a[i] > r:
			w = i
			r = a[i]
	if w in d:
		d[w] += 1
	else:
		d[w] = 1
k = max(d.values())
z = float('inf')
for i in d:
	if d[i] == k:
		z = min(z, i)
print(z + 1)


(n, m) = map(int, input().split())
votes = [0] * 100
indexCounter = [0] * 100
for i in range(m):
	votes = list(map(int, input().split()))
	indexCounter[votes.index(max(votes))] += 1
	votes.clear()
print(indexCounter.index(max(indexCounter)) + 1)


(n, m) = map(int, input().split())
L = []
for i in range(m):
	v = list(map(int, input().split()))
	c = v.index(max(v))
	L += [c + 1]
m = 0
C = 101
for i in L:
	a = L.count(i)
	if m == a:
		if i < C:
			C = i
	elif m < a:
		m = a
		C = i
print(C)


(n, m) = map(int, input().split())
winner = [0] * n
for i in range(m):
	town = list(map(int, input().split()))
	winner[town.index(max(town))] += 1
print(winner.index(max(winner)) + 1)


import sys

class Candidates:

	def __init__(self, n):
		self.votes = [0] * n

	def winner(self, i):
		self.votes[i] += 1

	def won(self):
		return self.votes.index(max(self.votes)) + 1

	def show(self):
		for c in self.votes:
			print(' {} '.format(c))

def main():
	(n, m) = [int(x) for x in sys.stdin.readline().split()]
	ca = Candidates(n)
	votes = []
	for i in range(m):
		row = [int(x) for x in sys.stdin.readline().split()]
		winner = row.index(max(row))
		ca.winner(winner)
		votes.append(row)
	print(ca.won())
main()


from collections import defaultdict
MyDict = defaultdict(int)
X = list(map(int, input().split()))
for i in range(X[1]):
	Temp = list(map(int, input().split()))
	MyDict[Temp.index(max(Temp))] += 1
Max = max(MyDict.values())
for key in sorted(MyDict.keys()):
	if MyDict[key] == Max:
		print(key + 1)
		exit()


import math

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans

def comb(n, c):
	return fact(n) // (fact(n - c) * c)
(n, m) = map(int, input().split())
d = {i: 0 for i in range(1, n + 1)}
for _ in range(m):
	vals = list(map(int, input().split()))
	ad = 1
	maxi = 0
	for i in range(n):
		if vals[i] > maxi:
			ad = i + 1
			maxi = vals[i]
	d[ad] += 1
v = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(v[0][0])


(n, m) = map(int, input().split())
(l, t1) = ([], [])
for _ in range(m):
	l1 = list(map(int, input().split()))
	l.append(l1)
	tp = max(l1)
	ls = l1.index(tp) + 1
	t1.append(ls)
la = {}
for i in range(len(t1)):
	if t1[i] in la:
		la[t1[i]] += 1
	else:
		la[t1[i]] = 1
mt = la[max(la, key=lambda k: la[k])]
tp1 = []
for i in la.keys():
	if la[i] == mt:
		tp1.append(i)
print(min(tp1))


def index_max(lst):
	res = 0
	for i in range(1, len(lst)):
		if lst[i] > lst[res]:
			res = i
	return res
(n, m) = [int(x) for x in input().split()]
a = []
for i in range(m):
	a.append([int(x) for x in input().split()])
b = [0] * n
for lst in a:
	b[index_max(lst)] += 1
print(index_max(b) + 1)


s = input().split()
(n, m) = (int(s[0]), int(s[1]))
d = []
for i in range(1, n + 2):
	d.append(0)
MAXI = 0
for i in range(1, m + 1):
	s = input().split()
	maxi = 0
	for j in range(1, n + 1):
		maxi = max(maxi, int(s[j - 1]))
	for j in range(1, n + 1):
		if int(s[j - 1]) == maxi:
			d[j] = d[j] + 1
			MAXI = max(MAXI, d[j])
			break
for i in range(1, n + 1):
	if d[i] == MAXI:
		print(i)
		break


from sys import stdin
(n, m) = map(int, stdin.readline().strip().split())
cnt = [0 for i in range(n + 1)]
wins = []
for i in range(m):
	s = list(map(int, stdin.readline().strip().split()))
	mn = -10 ** 20
	x = 1
	y = -1
	for i in s:
		if i > mn:
			mn = i
			y = x
		x += 1
	cnt[y] += 1
	wins.append(y)
mn = -10 ** 20
wins.sort()
w = -1
for i in wins:
	if mn < cnt[i]:
		w = i
		mn = cnt[i]
print(w)


from collections import Counter
(n, m) = map(int, input().split())
c = [0] * m
for i in range(m):
	a = list(map(int, input().split()))
	c[i] = a.index(max(a))
c = [c.count(i) for i in range(n)]
print(c.index(max(c)) + 1)


(n, k) = list(map(int, input().split()))
p = []
for x in range(k):
	pa = list(map(int, input().split()))
	p.append(pa.index(max(pa)) + 1)
sam = list(set(p))
ta = []
sam.sort()
for item in sam:
	ta.append(p.count(item))
la = ta.index(max(ta))
print(sam[la])


(n, m) = map(int, input().split())
a = [0] * 10001
for i in range(m):
	s = list(map(int, input().split()))
	index = s.index(max(s)) + 1
	a[index] += 1
resindex = a.index(max(a))
print(resindex)


import operator as op
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from functools import reduce
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, gcd, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def def_value():
	return 0
(n, m) = invr()
candidate = [0] * n
a = []
for i in range(m):
	a.append(inlist())
for city in a:
	mx = -1
	mxi = 0
	for i in range(n):
		if city[i] > mx:
			mx = city[i]
			mxi = i
	candidate[mxi] += 1
mx = -1
mxi = 0
for i in range(n):
	if candidate[i] > mx:
		mx = candidate[i]
		mxi = i
print(mxi + 1)


(n, m) = map(int, input().split())
(d, s) = ({}, set())
for i in range(m):
	(*l,) = map(int, input().split())
	p = l.index(max(l)) + 1
	d[p] = d.get(p, 0) + 1
t = max(d.values())
for i in d.keys():
	if d[i] == t:
		s.add(i)
print(min(s))


(n, m) = [int(i) for i in input().split()]
ls = list()
for i in range(n):
	ls.append(0)
for i in range(m):
	city = [int(i) for i in input().split()]
	win = 0
	winv = 0
	for j in range(n):
		if city[j] > winv:
			win = j
			winv = city[j]
	ls[win] += 1
maxv = 0
win = 0
for i in range(n):
	if ls[i] > maxv:
		win = i + 1
		maxv = ls[i]
print(win)


(n, m) = [int(i) for i in input().split()]
h = [0 for i in range(n)]
for i in range(m):
	s = [int(i) for i in input().split()]
	h[s.index(max(s))] += 1
print(h.index(max(h)) + 1)


def winner_idx(lst):
	w = lst.index(max(lst))
	if w == 0:
		w = 1
	return w
(n, m) = map(int, input().split())
ppl = [0] * (n + 1)
for _ in range(m):
	a = list(map(int, input().split()))
	a.insert(0, 0)
	w = winner_idx(a)
	ppl[w] += 1
print(winner_idx(ppl))


s = input().split(' ')
N = int(s[0])
M = int(s[1])
c = [0] * N
for m in range(M):
	s = input().split(' ')
	a = [int(x) for x in s]
	c[a.index(max(a))] += 1
print(c.index(max(c)) + 1)


(n, m) = map(int, input().split())
vote = []
for i in range(m):
	vote.append(list(map(int, input().split())))

def win(vote, n):
	temp_max = 0
	for i in range(n):
		if temp_max < vote[i]:
			temp_max = vote[i]
	for i in range(n):
		if vote[i] == temp_max:
			return i
for i in range(m):
	vote[i] = win(vote[i], n)
allvotes = [0] * n
for i in range(m):
	allvotes[vote[i]] += 1
print(win(allvotes, n) + 1)


from sys import stdin, stdout, stderr, setrecursionlimit
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	import inspect, re
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

def read():
	return stdin.readline().rstrip()

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readintarr(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writearr(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
(ops, cities) = readintarr()
a = []
for _ in range(cities):
	a.append(readintarr())
dd(a)
r = [0 for _ in range(ops)]
for i in range(cities):
	w = a[i].index(max(a[i]))
	r[w] += 1
dd(r)
write(r.index(max(r)) + 1)


l = list(map(int, input().split()))
lp = []
for _ in range(l[1]):
	l1 = list(map(int, input().split()))
	lp.append(l1)
cit = []
for i in lp:
	win = 0
	for j in i:
		if j > i[win]:
			win = i.index(j)
	cit.append(win)
se = list(set(cit))
final_count = []
for i in se:
	final_count.append(cit.count(i))
print(se[final_count.index(max(final_count))] + 1)


(n, m) = [int(i) for i in input().split()]
l = n * [0]
for i in range(m):
	a = [int(j) for j in input().split()]
	m = max(a)
	ind = a.index(m)
	l[ind] += 1
m = max(l)
ind = l.index(m)
print(ind + 1)


def most_common(lst):
	return max(set(lst), key=lst.count)
(n, m) = [int(x) for x in input().split()]
a = []
for i in range(m):
	t = [int(x) for x in input().split()]
	a.append(t.index(max(t)) + 1)
print(most_common(a))


(x, y) = list(map(int, input().split()))
lista = []
ans = [0] * x
for i in range(y):
	lista.append(list(map(int, input().split())))
for i in range(y):
	ans[lista[i].index(max(lista[i]))] += 1
print(ans.index(max(ans)) + 1)


(n, m) = map(int, input().split())
wins = [0] * n
for i in range(m):
	x = list(map(int, input().split()))
	get_max = -1
	get_ind = -1
	for i in range(len(x)):
		if x[i] > get_max:
			get_max = x[i]
			get_ind = i
	wins[get_ind] += 1
get_max = -1
get_ind = -1
for i in range(n):
	if wins[i] > get_max:
		get_max = wins[i]
		get_ind = i
print(get_ind + 1)


from collections import Counter
[n, m] = [int(x) for x in input().split()]
cities = []
for i in range(m):
	votes = [int(x) for x in input().split()]
	cities.append(votes.index(max(votes)) + 1)
print(Counter(cities).most_common()[0][0])


(n, m) = list(map(int, input().split()))
cit = [0] * n
for i in range(m):
	a1 = list(map(int, input().split()))
	maxi = 0
	mxx = 0
	for j in range(n):
		if a1[j] > mxx:
			mxx = a1[j]
			maxi = j
	cit[maxi] += 1
maxi = 0
mxx = 0
for i in range(n):
	if cit[i] > mxx:
		mxx = cit[i]
		maxi = i + 1
print(maxi)


def maxval(lis):
	m = lis[0]
	pos = 0
	for i in range(len(lis)):
		if lis[i] > m:
			m = lis[i]
			pos = i
	return pos
elect = []
winners = []
(n, m) = map(int, input().split())
for i in range(m):
	elect.append(list(map(int, input().split())))
	winners.append(maxval(elect[i]) + 1)
win = -1
c = 0
for i in winners:
	if winners.count(i) > c or (winners.count(i) == c and i < win):
		c = winners.count(i)
		win = i
print(win)


(i, c) = map(int, input().split())
m = {elem: 0 for elem in range(1, i + 1)}
for x in range(c):
	l = list(map(int, input().split()))
	m[l.index(max(l)) + 1] += 1
print(max(m, key=m.get))


Array = [0] * 100
(n, m) = map(int, input().split())
for i in range(m):
	index = 0
	maxn = 0
	int_list = list(map(int, input().split()))
	for j in range(n):
		if maxn < int_list[j]:
			maxn = int_list[j]
			index = j
	Array[index] += 1
mvalue = max(Array)
max_index = Array.index(mvalue)
print(max_index + 1)


import math
import sys
x = list(map(int, input().split()))
n = x[0]
m = x[1]
W = []
NW = []
for i in range(0, n):
	NW.append(0)
for i in range(0, m):
	l = list(map(int, input().split()))
	k = max(l)
	for j in range(0, n):
		if l[j] == k:
			w = j
			break
	W.append(w)
for i in range(0, m):
	NW[W[i]] += 1
k = max(NW)
for i in range(0, n):
	if NW[i] == k:
		w = i + 1
		break
print(w)


(n, m) = list(map(int, input().split()))
cities = {}
for _ in range(m):
	votes = list(map(int, input().split()))
	best_index = 0
	for (index, vote) in enumerate(votes):
		if vote > votes[best_index]:
			best_index = index
	if best_index not in cities:
		cities[best_index] = 0
	cities[best_index] = cities[best_index] + 1
best = -1
best_candidate = None
for (candidate, votes) in cities.items():
	if votes > best:
		best = votes
		best_candidate = candidate
print(best_candidate + 1)


(n, m) = input().split()
n = int(n)
m = int(m)
l = []
for i in range(m):
	l1 = input().split()
	for j in range(n):
		l1[j] = int(l1[j])
	l.append(l1)
r = []
for i in range(m):
	k = 0
	p = 0
	for j in range(n):
		if l[i][j] > k:
			k = l[i][j]
			p = j
	r.append(p)
s = [0] * n
for i in range(n):
	if s[i] == 0:
		s[i] = r.count(i)
q = max(s)
for i in range(n):
	if s[i] == q:
		print(i + 1)
		break


from collections import Counter
c = [0] * 101
(n, m) = map(int, input().split())
for _ in range(m):
	a = list(map(int, input().split()))
	max_value = a.index(max(a))
	c[max_value] = c[max_value] + 1
print(c.index(max(c)) + 1)