John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.

There are $n$ students, each of them has a unique id (from $1$ to $n$). Thomas's id is $1$. Every student has four scores correspond to his or her English, German, Math, and History scores. The students are given in order of increasing of their ids.

In the table, the students will be sorted by decreasing the sum of their scores. So, a student with the largest sum will get the first place. If two or more students have the same sum, these students will be sorted by increasing their ids. 

Please help John find out the rank of his son. 


-----Input-----

The first line contains a single integer $n$ ($1 \le n \le 1000$) — the number of students.

Each of the next $n$ lines contains four integers $a_i$, $b_i$, $c_i$, and $d_i$ ($0\leq a_i, b_i, c_i, d_i\leq 100$) — the grades of the $i$-th student on English, German, Math, and History. The id of the $i$-th student is equal to $i$.


-----Output-----

Print the rank of Thomas Smith. Thomas's id is $1$.


-----Examples-----
Input
5
100 98 100 100
100 100 100 100
100 100 99 99
90 99 90 100
100 98 60 99

Output
2

Input
6
100 80 90 99
60 60 60 60
90 60 100 60
60 100 60 80
100 100 0 100
0 0 0 0

Output
1



-----Note-----

In the first sample, the students got total scores: $398$, $400$, $398$, $379$, and $357$. Among the $5$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $2$.

In the second sample, the students got total scores: $369$, $240$, $310$, $300$, $300$, and $0$. Among the $6$ students, Thomas got the highest score, so his rank is $1$.

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
x = int(input())
S = []
for i in range(x):
	(a, b, c, d) = map(int, input().split())
	S.append(a + b + c + d)
N = S[0]
S.sort(reverse=True)
for i in range(x):
	if S[i] == N:
		print(i + 1)
		break


students = int(input())

def StudentScore(l):
	return sorted([sum(i) for i in l])[::-1]
marks = [list(map(int, input().split(' '))) for i in range(students)]
rank = StudentScore(marks)
print(rank.index(sum(marks[0])) + 1)


a = int(input())
b = []
c = []
Tom = 0
Tom_index = 0
for x in range(a):
	b.append(list(map(int, input().split())))
for x in b:
	c.append(sum(x))
Tom = c[0]
d = sorted(c, reverse=True)
Tom_index = d.index(Tom)
print(Tom_index + 1)


n = int(input())
A = [0] * n
for i in range(n):
	A[i] = sum(map(int, input().split()))
better = 1
for i in range(1, n):
	if A[i] > A[0]:
		better += 1
print(better)


import bisect
main = []
for i in range(int(input())):
	l = list(map(int, input().split()))
	s = sum(l)
	main.append(s)
score = main[0]
main.sort()
print(len(main) - bisect.bisect_right(main, score) + 1)


n = int(input())
l = []
for i in range(n):
	t = sum(list(map(int, input().split(' '))))
	l.append((t, i))
l = sorted(l, reverse=True, key=lambda tup: (tup[0], -tup[1]))
for i in range(n):
	if l[i][1] == 0:
		print(i + 1)
		break


n = int(input())
d = []
for i in range(n):
	l = list(map(int, input().split()))
	l = sum(l)
	d.append(l)
rank = d[0]
d.sort()
d.reverse()
final = d.index(rank) + 1
print(final)


n = int(input())
a = [input().split() for i in range(n)]
k = int(a[0][0]) + int(a[0][1]) + int(a[0][2]) + int(a[0][3])
t = 1
for i in range(1, n):
	if int(a[i][0]) + int(a[i][1]) + int(a[i][2]) + int(a[i][3]) > k:
		t += 1
print(t)


n = int(input())
rank = 1
su1 = sum(map(int, input().split()))
for i in range(n - 1):
	su = sum(map(int, input().split()))
	if su > su1:
		rank += 1
print(rank)


n = int(input())
a = list(map(int, input().split()))
a = sum(a) / 5
b = 1
for i in range(n - 1):
	c = sum(list(map(int, input().split()))) / 5
	if c > a:
		b += 1
print(b)


a = int(input())
m = []
for r in range(0, a):
	b = input()
	c = b.split()
	d = list(map(int, c))
	f = sum(d)
	m.append(f)
rank = 1
for i in range(1, len(m)):
	if m[i] > m[0]:
		rank += 1
print(rank)


n = int(input())
listMarks = []
for i in range(0, n):
	(E, G, M, H) = map(int, input().split())
	listMarks.append(E + G + M + H)
John = listMarks[0]
listMarks.sort(reverse=True)
print(listMarks.index(John) + 1)


a = int(input())
n = 0
l = []
r = []
y = 0
while n < a:
	(b, c, d, e) = input().split()
	l.append(b)
	l.append(c)
	l.append(d)
	l.append(e)
	z = int(l[4 * n]) + int(l[4 * n + 1]) + int(l[4 * n + 2]) + int(l[4 * n + 3])
	r.append(z)
	n = n + 1
v = r[0]
r.sort(reverse=True)
print(r.index(v) + 1)


n = int(input())
li = []
for i in range(n):
	li.append(sum(map(int, input().split())))
a = li[0]
li = sorted(li, reverse=True)
print(li.index(a) + 1)


n = int(input())
v = []
for i in range(n):
	hv = [int(X) for X in input().split()]
	v.append(sum(hv))
h = v[0]
v.sort(reverse=True)
print(v.index(h) + 1)


n = int(input())
a = []
t = sum(list(map(int, input().split())))
ans = 1
for i in range(n - 1):
	a = list(map(int, input().split()))
	if t < sum(a):
		ans += 1
print(ans)


x = int(input())
l = []
for i in range(x):
	l = l + [sum(list(map(int, input().split())))]
c = l[0]
l.sort(reverse=True)
print(l.index(c) + 1)


n = int(input())
s = [0] * n
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	s[i] = a + b + c + d
t = s[0]
s.sort()
s.reverse()
for anand in range(n):
	if s[anand] == t:
		rank = anand + 1
		break
print(rank)


def calculate_scores():
	return sum((int(score) for score in input().split()))

def main():
	n_students = int(input())
	thomas_score = calculate_scores()
	count_higher_scores = sum((1 for _ in range(1, n_students) if calculate_scores() > thomas_score))
	print(count_higher_scores + 1)
main()


a = int(input())
o = []
q = 0
d = 1
for i in range(a):
	x = sum([int(i) for i in input().split()])
	if q == 0:
		j = x
	o += [x]
	p = sorted(o)
	q += 1
while True:
	if p[-d] == j:
		print(d)
		break
	else:
		d += 1


N = int(input())
A = [None] * N
for i in range(N):
	A[i] = list(map(int, input().split()))
S = [None] * N
for i in range(N):
	S[i] = sum(A[i])
John = S[0]
S.sort(reverse=True)
for i in range(N):
	if S[i] == John:
		break
print(i + 1)


n = int(input())
x = sum(list(map(int, input().split())))
answer = [x]
for i in range(n - 1):
	answer.append(sum(list(map(int, input().split()))))
print(sorted(answer, reverse=True).index(x) + 1)


n = int(input())
(a, b, c, d) = map(int, input().split())
total1 = a + b + c + d
count = 1
for i in range(1, n):
	(a, b, c, d) = map(int, input().split())
	total = a + b + c + d
	if total1 < total:
		count = count + 1
print(count)


nl = int(input())
notasInt = []
notasLista = []
for l in range(nl):
	notas = input().split(' ')
	for n in range(len(notas)):
		notasInt.append(int(notas[n]))
	notasLista.append(sum(notasInt))
	notasInt = []
Thomas = notasLista[0]
print(sorted(notasLista, reverse=True).index(Thomas) + 1)


n = int(input())
j = 0
d = {}
for i in range(1, n + 1):
	arr = list(map(int, input().split()))
	a = sum(arr)
	d[i] = a
s = dict(sorted(d.items(), key=lambda item: item[1], reverse=True))
for x in s:
	j = j + 1
	if x == 1:
		break
print(j)


n = int(input())
a = [[]] * n
for i in range(n):
	a[i] = [i, sum(map(int, input().split()))]
a.sort(key=lambda x: (-x[1], x[0]))
print(list(map(lambda x: x[0], a)).index(0) + 1)


n = int(input())
l = []
for _ in range(n):
	temp = list(map(int, input().split()))
	l.append(sum(temp))
t = l[0]
l.sort(reverse=True)
print(l.index(t) + 1)


result = 1
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if i == 0:
		initial = a + b + c + d
	elif a + b + c + d > initial:
		result += 1
print(result)


n = int(input())
s = 1
k = r = 0
for i in range(n):
	a = list(map(int, input().split()))
	if r == 0 and sum(a) > k:
		k = sum(a)
		r = 1
	if sum(a) > k:
		s += 1
print(s)


n = int(input())
(a, b, c, d) = map(int, input().split())
s = a + b + c + d
ans = 1
for i in range(2, n + 1):
	(a, b, c, d) = map(int, input().split())
	if a + b + c + d > s:
		ans += 1
print(ans)


l = []
s = 0
n = int(input())
for x in range(n):
	a = list(map(int, input().split()))
	b = sum(a)
	l.append(b)
c = l[0]
for x in range(n):
	if l[x] > c:
		s += 1
print(s + 1)


n = int(input())
d = []
s = 1
for i in range(n):
	a = input().split()
	a = [int(x) for x in a]
	k = sum(a)
	d.append(k)
	if d[0] < k:
		s += 1
print(s)


n = int(input())
ids = []
marks = []
for i in range(n):
	ids.append(i + 1)
	tmp = list(map(int, input().split()))
	marks.append([sum(tmp), i + 1])
marks.sort(reverse=True)
eqs = []

def srch():
	for i in range(n):
		if marks[i][1] == 1:
			for j in range(n):
				if marks[j][0] == marks[i][0]:
					return j + 1
			return i + 1
print(srch())


n = int(input())
a = [[-sum(map(int, input().split())), i] for i in range(n)]
a.sort()
for i in range(n):
	if a[i][1] == 0:
		print(i + 1)
		break


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	sum1 = 0
	for i in range(4):
		sum1 = sum1 + m[i]
	l.append(sum1)
c = l[0]
l.sort(reverse=True)
print(l.index(c) + 1)


n = int(input())
a = []
m = 0
for i in range(n):
	a.append(sum(list(map(int, input().split()))))
	if i == 0:
		m = a[i]
a.sort(reverse=True)
for i in range(n):
	if a[i] == m:
		print(i + 1)
		break


d = {}
c = []
a = []
n = int(input())
for i in range(n):
	c.append(list(map(int, input().split())))
	a += [[sum(c[i]), n - i - 1]]
a.sort(reverse=True)
for i in range(n):
	if a[i][1] == n - 1:
		print(i + 1)


n = int(input())
l = [sum(map(int, input().split())) for _ in range(n)]
a = l[0]
l.sort(reverse=True)
print(l.index(a) + 1)


def rank():
	n = int(input())
	l = list()
	l2 = list()
	for i in range(n):
		l1 = list()
		s = input()
		for i in s.split():
			l1.append(int(i))
		l.append(l1)
	for l1 in l:
		s = 0
		for j in l1:
			s += j
		l2.append(s)
	t = l2[0]
	l2.sort(reverse=True)
	r = 1
	for i in l2:
		if t == i:
			print(r)
			break
		else:
			r = r + 1
rank()


n = int(input())
b = []
for i in range(n):
	a = list(map(int, input().split()))
	b.append(sum(a))
c = b[0]
b = list(reversed(sorted(b)))
print(b.index(c) + 1)


n = int(input())
d = {}
for i in range(n):
	a = list(map(int, input().split()))
	d[i + 1] = sum(a)
a = list(zip(d.values(), d.keys()))
a = sorted(a, reverse=True)
for i in range(len(a)):
	if a[i][1] == 1:
		c = a[i][0]
cnt = 0
for i in range(len(a)):
	if a[i][0] == c and a[i][1] != 1:
		cnt += 1
for i in range(len(a)):
	if a[i][0] == c and a[i][1] == 1:
		ans = i + 1
print(ans - cnt)


n = int(input())
s = []
for i in range(n):
	s.append(sum(list(map(int, input().split(' ')))))
temp = s[0]
s.sort(reverse=True)
print(s.index(temp) + 1)


N = int(input())
L = []
S = []
for i in range(N):
	L.append(list(map(int, input().split())))
	S.append(sum(L[i]))
count = 0
for i in range(1, N):
	if S[i] > S[0]:
		count += 1
print(count + 1)


a = [sum(map(int, input().split())) for _ in range(int(input()))]
print(sum((x > a[0] for x in a[1:])) + 1)


def sum_row(s):
	return sum(map(int, s.strip().split()))
n = int(input().strip())
point_counters = [0 for i in range(401)]
target_search_points = sum_row(input())
for i in range(1, n):
	points = sum_row(input())
	point_counters[points] += 1
above_counter = 0
for i in range(400, -1, -1):
	if target_search_points == i:
		print(above_counter + 1)
	above_counter += point_counters[i]


n = int(input())
b = []
c = 0
for i in range(n):
	a = list(map(int, input().split()))
	b.append(a)
for i in range(len(b)):
	b[i] = sum(b[i])
if b.index(max(b)) == 0:
	print('1')
else:
	while b.index(max(b)) != 0:
		b.remove(max(b))
		c += 1
	print(c + 1)


from collections import defaultdict
n = int(input())
ranks_dict = defaultdict(list)
for i in range(n):
	ranks_dict[sum((int(x) for x in input().split()))].append(i + 1)
ranks_score = sorted(ranks_dict, reverse=True)
rank = 0
for i in ranks_score:
	if 1 in sorted(ranks_dict[i]):
		print(rank + 1)
		break
	else:
		rank += len(ranks_dict[i])


n = int(input().strip().split()[0])
l = []
for i in range(1, n + 1):
	curr = list(map(int, input().strip().split()))
	currsum = sum(curr)
	l.append([currsum, i])
l.sort(key=lambda x: (x[0], -x[1]), reverse=True)
l2 = [a[1] for a in l]
print(l2.index(1) + 1)


n = int(input())
ar = [sum(map(int, input().split())) for i in range(n)]
thomas = ar[0]
ar.sort(reverse=True)
rank = 1
for i in range(n):
	if thomas == ar[i]:
		print(rank)
		exit()
	rank = rank + 1


n = int(input())
a = []
ans = 1
a.append([])
a[0] += map(int, input().split())
a[0].append(a[0][0] + a[0][1] + a[0][2] + a[0][3])
for i in range(1, n):
	a.append([])
	a[i] += map(int, input().split())
	a[i].append(a[i][0] + a[i][1] + a[i][2] + a[i][3])
	if a[i][4] > a[0][4]:
		ans += 1
print(ans)


n = int(input())
arr = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	s = a + b + c + d
	arr.append((s, i))
arr.sort()
arr = arr[::-1]
for i in range(n):
	if arr[i][1] == 0:
		ans = i
		cur = arr[i][0]
		break
ans += 1
count = 0
for i in range(n):
	if arr[i][0] == cur:
		count += 1
count -= 1
ans -= count
print(ans)


n = int(input())
scores = []
r = 0
for i in range(n):
	(a, b, c, d) = input().split()
	(a, b, c, d) = (int(a), int(b), int(c), int(d))
	s = a + b + c + d
	scores.append(s)
result = sorted(scores, reverse=True)
for i in range(n):
	r += 1
	if result[i] == scores[0]:
		print(r)
		break


n = int(input())
sommes = []
for i in range(n):
	l = map(int, input().split())
	sommes.append(sum(l))
c = 0
for j in range(1, len(sommes)):
	if sommes[j] <= sommes[0]:
		c += 1
print(n - c)


n = int(input())
marks = []
for i in range(n):
	n = sum(list(map(int, input().split())))
	marks.append((n, i))
	if i == 0:
		p = n
marks.sort(reverse=True)
t = [i for (i, j) in marks]
print(t.index(p) + 1)


n = int(input())
t = sum([int(s) for s in input().split(' ')])
cnt = 0
for i in range(n - 1):
	if sum([int(s) for s in input().split(' ')]) > t:
		cnt += 1
print(cnt + 1)


n = int(input())
a = [sum(map(int, input().split())) for i in range(n)]
s = a[0]
a = sorted(a)[::-1]
print(a.index(s) + 1)


n = int(input())
a = []
for i in range(n):
	(e, g, m, h) = map(int, input().split())
	a.append(e + g + m + h)
first = a[0]
one = 1
for i in range(1, n):
	if first < a[i]:
		one = one + 1
print(one)


n = int(input())
max = 1
a = sum(map(int, input().split()))
for j in range(2, n + 1):
	b = sum(map(int, input().split()))
	if a < b:
		max += 1
print(max)


n = int(input())
p = []
for i in range(n):
	p.append((i, sum(map(int, input().split()))))
est1 = p[0][1]
t = sorted(p, key=lambda x: x[1])[::-1]
est = [j for (i, j) in t]
print(est.index(est1) + 1)


num = int(input())
john = 0
place = 0
for i in range(num):
	l = list(map(int, input().split()[:4]))
	tmp = sum(l)
	if i == 0:
		john = tmp
	elif john < tmp:
		place += 1
print(place + 1)


n = int(input())
tid = 1
tsum = 0
for idx in range(n):
	s = sum([int(i) for i in input().strip().split(' ')])
	if idx == 0:
		tsum = s
	elif s > tsum:
		tid += 1
print(tid)


n = int(input())
ls = []
for i in range(n):
	(a, b, c, d) = [int(x) for x in input().split()]
	ls.append(a + b + c + d)
f = ls[0]
ls.sort(reverse=True)
for i in range(n):
	if f == ls[i]:
		print(i + 1)
		break


n = int(input())
u = []
t = 0
for i in range(n):
	u.append(sum(list(map(int, input().split()))))
t = u[0]
u.sort(reverse=1)
for i in range(n):
	if u[i] == t:
		print(i + 1)
		break


def mi():
	return map(int, input().split())
n = int(input())
a = [0] * n
for i in range(n):
	a[i] = [sum(list(mi())), i]
a.sort(key=lambda k: (k[0], -k[1]), reverse=True)
for i in range(n):
	a[i] = a[i][-1]
print(a.index(0) + 1)


n = int(input())
(sub1, sub2, sub3, sub4) = map(int, input().split())
marks = sub4 + sub3 + sub2 + sub1
countup = 0
for i in range(0, n - 1):
	(sub1, sub2, sub3, sub4) = map(int, input().split())
	total = sub4 + sub3 + sub2 + sub1
	if total > marks:
		countup += 1
print(countup + 1)


n = int(input())
l = [0] * n
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	l[i] = a + b + c + d
tom = l[0]
k = 1
for i in range(1, n):
	if l[i] > tom:
		k += 1
print(k)


n = int(input())
a = []
for i in range(n):
	s = input().split()
	sum1 = int(s[0]) + int(s[1]) + int(s[2]) + int(s[3])
	a.append(sum1)
r = 1
for i in range(n - 1):
	if a[0] < a[i + 1]:
		r += 1
print(r)


n = int(input())
cur = 0
res = 0
for i in range(n):
	(a, b, c, d) = list(map(int, input().strip().split()))
	score = a + b + c + d
	if i == 0:
		cur = score
	elif score > cur:
		res += 1
print(res + 1)


n = int(input())
count = 1
(a, b, c, d) = map(int, input().split())
s = a + b + c + d
for i in range(n - 1):
	(n, k, m, x) = map(int, input().split())
	q = n + k + m + x
	if q > s:
		count = count + 1
print(count)


n = int(input())
scores = []
for i in range(n):
	score = sum([int(c) for c in input().split()])
	scores.append(score)
pos = 1
for score in scores:
	if score > scores[0]:
		pos += 1
print(pos)


n = int(input())
s = []
for _ in range(n):
	(e, g, m, h) = map(int, input().split())
	s.append((e, g, m, h))
t = sum(s[0])
rank = 1
for i in range(1, n):
	if sum(s[i]) > t:
		rank += 1
print(rank)


import sys
n = int(input())
(a, b, c, d) = map(int, sys.stdin.readline().split())
s1 = a + b + c + d
rank = 1
for i in range(1, n):
	(a, b, c, d) = map(int, sys.stdin.readline().split())
	s = a + b + c + d
	if s > s1:
		rank += 1
print(rank)


t = int(input())
a = []
for _ in range(t):
	(m, n, o, p) = map(int, input().split())
	a.append(m + n + o + p)
c = 0
m = a[0]
for item in a:
	if item > m:
		c = c + 1
print(c + 1)


def go():
	n = int(input())
	t = sum([int(i) for i in input().split(' ')])
	l = [t]
	for i in range(n - 1):
		l.append(sum([int(i) for i in input().split(' ')]))
	for (i, v) in enumerate(sorted(l, reverse=True)):
		if v == t:
			return i + 1
print(go())


b = []
for i in range(int(input())):
	a = list(map(int, input().split()))
	b.append(sum(a))
c = b[0]
b.sort()
b = b[::-1]
print(b.index(c) + 1)


try:
	n = int(input())
	l = []
	for each in range(0, n):
		(a, b, c, d) = map(int, input().split())
		sum = a + b + c + d
		l.append(sum)
		if each == 0:
			thomas_score = sum
	rank = 1
	for each in l:
		if thomas_score < each:
			rank += 1
	print(rank)
except:
	pass


student_count = int(input())
table = list()
for i in range(student_count):
	input_list = list(map(int, input().split()))
	table.append((i + 1, sum(input_list)))
ans_list = sorted(table, key=lambda student: student[1], reverse=True)
rank = 0
for score_tup in ans_list:
	rank = rank + 1
	if score_tup[0] == 1:
		print(rank)
		break


n = int(input())
t = list(map(int, input().split()))
count = 1
for j in range(1, n):
	num = list(map(int, input().split()))
	if sum(t) < sum(num):
		count += 1
print(count)


n = int(input())
(a, *b) = (sum(map(int, input().split())) for i in range(n))
b.sort()
for (i, s) in enumerate(reversed(b), 1):
	if a >= s:
		print(i)
		break
else:
	print(n)


n = int(input())
t = sum(map(int, input().split()))
count = 0
for _ in range(n - 1):
	a = sum(map(int, input().split()))
	if a > t:
		count += 1
print(count + 1)


cases = int(input())
lst = []
while cases:
	cases -= 1
	arr = list(map(int, input().split()))
	i = 1
	lst.append([i, sum(arr)])
	i += 1
boys = lst[0][1]
sor = sorted(lst, key=lambda x: x[1], reverse=True)
step = 1
for i in sor:
	if i[1] == boys:
		print(step)
		break
	step += 1


n = int(input())
firstList = list(map(int, input().split()))
summ = firstList[0] + firstList[1] + firstList[2] + firstList[3]
table = [list(map(int, input().split())) for i in range(n - 1)]
answer = 1
buffer = 0
for i in range(0, n - 1):
	for j in range(4):
		buffer += table[i][j]
	if buffer > summ:
		answer += 1
	buffer = 0
print(answer)


li = []
for _ in range(int(input())):
	li.append(list(map(int, input().split())))
total = list(map(sum, li))
thomas = total[0]
total.sort(reverse=True)
print(total.index(thomas) + 1)


from sys import stdin, stdout
from math import log2
n = int(stdin.readline())
challengers = []
for i in range(n):
	(a, b, c, d) = map(int, stdin.readline().split())
	challengers.append((-(a + b + c + d), i))
challengers.sort()
for i in range(n):
	if not challengers[i][1]:
		stdout.write(str(i + 1))
		break


n = int(input())
a_sum = sum(map(int, input().split()))
rank = 1
for _ in range(n - 1):
	if a_sum < sum(map(int, input().split())):
		rank += 1
print(rank)


n = int(input())
result = []
for i in range(n):
	result.append(sum(map(int, input().split())))
jim_score = result[0]
print(sum([1 for r in result if r > jim_score]) + 1)


l = []
for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	l.append(a + b + c + d)
id = l[0]
l.sort(reverse=True)
for i in range(len(l)):
	if id == l[i]:
		print(i + 1)
		break


n = int(input())
A = list()
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	A.append(a + b + c + d)
k = A[0]
A.sort(reverse=True)
print(A.index(k) + 1)


n = int(input())
table = []
l = map(int, input().split())
sonMark = sum(l)
table.append(sonMark)
for i in range(n - 1):
	l = []
	l = map(int, input().split())
	table.append(sum(l))
table.sort()
table = table[::-1]
for i in range(len(table)):
	if sonMark == table[i]:
		print(i + 1)
		break


a = int(input())
(a1, a2, a3, a4) = map(int, input().split())
k = a1 + a2 + a3 + a4
c = 1
for i in range(a - 1):
	(a1, a2, a3, a4) = map(int, input().split())
	n = a1 + a2 + a3 + a4
	if n > k:
		c += 1
print(c)


n = int(input())
johnlist = input().split(' ')
john = 0
for item in johnlist:
	john += int(item)
scores = []
for i in range(n - 1):
	templist = input().split(' ')
	sum = 0
	for item in templist:
		sum += int(item)
	scores.append(sum)
scores = sorted(scores, reverse=True)
place = len(scores) + 1
for i in range(n - 1):
	if scores[i] <= john:
		place = i + 1
		break
print(place)


n = int(input())
s = []
for i in range(n):
	a = sum(list(map(int, input().split())))
	s.append(a)
j = 1
for i in range(1, n):
	if s[i] > s[0]:
		j += 1
print(j)


a = []
n = int(input())
for i in range(n):
	x = sum(map(int, input().split()))
	a.append(x)
b = a[0]
a.sort(reverse=True)
print(a.index(b) + 1)


n = int(input())
l = list(map(int, input().split()))
x = sum(l)
k = 1
for i in range(n - 1):
	l = list(map(int, input().split()))
	y = sum(l)
	if y > x:
		k += 1
print(k)


from sys import stdin
from math import *
line = stdin.readline().rstrip().split()
n = int(line[0])
numbers = list(map(int, stdin.readline().rstrip().split()))
scoreSon = sum(numbers)
numBefore = 0
for i in range(n - 1):
	numbers = list(map(int, stdin.readline().rstrip().split()))
	score = sum(numbers)
	if score > scoreSon:
		numBefore += 1
print(numBefore + 1)


n = int(input())
y = []
for i in range(n):
	l = list(map(int, input().split()))
	y.append(sum(l))
u = y[0]
y.sort(reverse=True)
for i in range(n):
	if y[i] == u:
		print(i + 1)
		break


n = int(input())
(a, b, c, d) = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
marks = a + b + c + d
rank = 1
for i in range(n - 1):
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	s = a + b + c + d
	if s > marks:
		rank += 1
print(rank)


n = int(input())
o = 1
a = map(int, input().split())
aa = sum(a)
for i in range(n - 1):
	b = map(int, input().split())
	a1 = sum(b)
	if aa < a1:
		o += 1
print(o)


n = int(input())
score = []
son = 0
for i in range(n):
	wk1 = sum([*list(map(int, input().split()))])
	if i == 0:
		son = wk1
	score.append(wk1)
score.sort(reverse=True)
print(score.index(son) + 1)


n = int(input())
a = []
b = []
c = []
d = []
score_1 = sum(map(int, input().split()))
rank = 1
for i in range(n - 1):
	score = sum(map(int, input().split()))
	if score_1 < score:
		rank += 1
print(rank)


a = int(input())
li = []
c = sum([int(x) for x in input().split()])
li.append(c)
for i in range(a - 1):
	b = sum([int(x) for x in input().split()])
	li.append(b)
li.sort()
li.reverse()
print(li.index(c) + 1)


sums = []
for _ in range(int(input())):
	sums.append(sum(list(map(int, input().split()))))
thomas = sums[0]
sums = sorted(sums)[::-1]
print(sums.index(thomas) + 1)


x = int(input())
m = []
v = 0
for i in range(x):
	c = map(int, input().split())
	m.append(sum(c))
v = m[0]
m.sort()
for i in range(x - 1, -1, -1):
	if m[i] == v:
		print(x - i)
		break


n = int(input())
scores = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	sum = a + b + c + d
	scores.append(sum)
thomas = scores[0]
scores.sort(reverse=True)
ind = scores.index(thomas) + 1
print(ind)


from sys import stdin, stdout
intn = lambda : int(stdin.readline())
strs = lambda : stdin.readline()[:-1]
lstr = lambda : list(stdin.readline()[:-1])
mint = lambda : map(int, stdin.readline().split())
lint = lambda : list(map(int, stdin.readline().split()))
out = lambda x: stdout.write(str(x) + '\n')
out_ = lambda x: stdout.write(str(x))

def main():
	n = intn()
	thomas = sum(lint())
	marks = [thomas]
	for i in range(1, n):
		marks.append(sum(lint()))
	marks.sort(reverse=True)
	out(marks.index(thomas) + 1)
main()


from functools import reduce
n = int(input())
count = 1
maxMarks = sum(list(map(int, input().split())))
for _ in range(n - 1):
	if sum(list(map(int, input().strip().split()))) > maxMarks:
		count += 1
print(count)


n = int(input())
x = []
for i in range(1, n + 1):
	l = list(map(int, input().split()))
	x.append([i, sum(l)])
x.sort(key=lambda x: x[1], reverse=True)
c = 0
for i in x:
	c += 1
	if i[0] == 1:
		print(c)
		break


(n, sum_) = (int(input()), sum(map(int, input().split())))
print(sum((sum(map(int, input().split())) > sum_ for _ in range(n - 1))) + 1)


n = int(input())
l = []
for i in range(n):
	a = list(map(int, input().split()))
	q = 0
	for i in a:
		q = q + i
	l.append(q)
d = l[0]
l.sort(reverse=True)
print(l.index(d) + 1)


x = int(input())
s = []
for n in range(x):
	s.append(sum([int(n) for n in input().split()]))
k = s[0]
s.sort()
s = s[::-1]
print(s.index(k) + 1)


n = int(input())
arr = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	if i == 0:
		sum1 = a + b + c + d
		arr.append(sum1)
	else:
		sum = a + b + c + d
		arr.append(sum)
arr.sort(reverse=True)
print(arr.index(sum1) + 1)


def getScore(lst):
	score = 0
	for i in lst:
		score += eval(i)
	return score

def main():
	n = eval(input())
	students = []
	for i in range(n):
		students.append(input().split())
	rank = 1
	score = getScore(students[0])
	for i in range(1, len(students)):
		if getScore(students[i]) > score:
			rank += 1
	return rank
print(main())


n = int(input())
results = []
for line_no in range(n):
	l = input()
	s = sum((int(i) for i in l.split(' ')))
	results.append((-s, line_no + 1))
results.sort()
for (rank, r) in enumerate(results):
	if r[1] == 1:
		print(rank + 1)
		break


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


import time

def calculateRank(smiths, recordStud):
	smithRank = 1
	for (x, grades) in enumerate(recordStud):
		if smiths == grades:
			return smithRank
		else:
			smithRank += 1
	return smithRank

def solve():
	stud = int(input())
	recordStud = []
	for x in range(stud):
		(subA, subB, subC, subD) = [int(x) for x in input().split()]
		sSum = subA + subB + subC + subD
		recordStud.append([sSum])
	smiths = recordStud[0]
	recordStud.sort(reverse=True)
	print(calculateRank(smiths, recordStud))
solve()


n = int(input())
l = []
for i in range(0, n):
	l.append(sum(map(int, input().split())))
y = l[0]
x = sorted(l, reverse=True)
print(x.index(y) + 1)


n = int(input())
(d, e, f, g) = [int(i) for i in input().split()]
p = d + e + f + g
r = 1
for i in range(1, n):
	(a, b, c, d) = [int(j) for j in input().split()]
	s = a + b + c + d
	if p < s:
		r = r + 1
print(r)


n = int(input())
x = []
i = 1
b = 0
while n:
	a = sum(list(map(int, input().split())))
	if i == 1:
		b = a
		i += 1
	x.append(a)
	n -= 1
x.sort(reverse=True)
for i in range(len(x)):
	if x[i] == b:
		print(i + 1)
		break


n = int(input())
t = sum([int(i) for i in input().split()])
p = 1
for i in range(n - 1):
	(a, b, c, d) = map(int, input().split())
	if a + b + c + d > t:
		p += 1
print(p)


n = int(input())
x = [sum([int(x) for x in input().split(' ')]) for _ in range(n)]
y = list(reversed(sorted(x)))
print(y.index(x[0]) + 1)


n = int(input())
curR = 1
grade = sum(list(map(int, input().split())))
for i in range(1, n):
	if sum(list(map(int, input().split()))) > grade:
		curR += 1
print(curR)


n = int(input())
k = []
t = []
for i in range(n):
	a = list(map(int, input().split()))
	k.append(sum(a))
	q = k[0]
for i in k:
	t.append(i)
	t.sort()
	t.reverse()
print(t.index(q) + 1)


n = int(input())
arr = []
for i in range(n):
	arr.append(list(map(int, input().split(' '))))
tom = arr[0]
arr = sorted(arr, key=lambda z: sum(z), reverse=True)
print(arr.index(tom) + 1)


from collections import defaultdict
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
mod = 10 ** 9 + 7
eps = 10 ** (-7)
AtoZ = [chr(i) for i in range(65, 65 + 26)]
atoz = [chr(i) for i in range(97, 97 + 26)]

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

def inpl_s():
	return list(input().split())
N = int(input())
li = []
for i in range(N):
	li.append(sum(inpl()))
to = li[0]
li.sort()
print(N + 1 - bisect.bisect_right(li, to))


n = int(input())
l = []
for i in range(n):
	list1 = list(map(int, input().split()))
	j = 0
	for i in list1:
		j += i
	l.append(j)
x = l[0]
l.sort()
l.reverse()
for i in range(len(l)):
	if l[i] == x:
		print(i + 1)
		break


n = int(input())
x = []
for i in range(n):
	x.append([sum(list(map(int, input().split()))), -i])
x.sort(reverse=True)
i = 0
while x[i][1] != 0:
	i += 1
print(i + 1)


n = int(input())
m = []
r = []
count = 0
for i in range(n):
	l = list(map(int, input().split()))
	m.append(l)
for j in range(len(m)):
	k = sum(m[j])
	r.append(k)
for i in range(1, len(r)):
	if r[i] > r[0]:
		count += 1
print(count + 1)


def solve(test):
	n = int(input())
	ans = 1
	s = list(map(int, input().split()))
	for i in range(n - 1):
		a = list(map(int, input().split()))
		if sum(a) > sum(s):
			ans += 1
	print(ans)
t = 1
for _ in range(t):
	solve(_ + 1)


n = int(input())
r = 1
s = sum((int(i) for i in input().split()))
for i in range(n - 1):
	if sum((int(i) for i in input().split())) > s:
		r += 1
print(r)


n = int(input())
r = 1
t = sum((int(x) for x in input().split()))
for i in range(1, n):
	if sum((int(x) for x in input().split())) > t:
		r += 1
print(r)


n = int(input())
data = []
sum_array = []
for x in range(n):
	arr = input().split(' ')
	data.append([int(item) for item in arr])
for y in data:
	sum_array.append(sum(y))
rank = 0
sum_array = sorted(sum_array)
for i in range(len(sum_array) - 1, -1, -1):
	if sum(data[0]) == sum_array[i]:
		rank = len(sum_array) - i
		break
print(rank)


n = int(input())
rank = 1
id1 = sum([int(x) for x in input().split()])
for i in range(n - 1):
	score = sum([int(x) for x in input().split()])
	if score > id1:
		rank += 1
print(rank)


def solve(arr):
	sum_arr = [sum(a) for a in arr]
	for (i, (score, id)) in enumerate(reversed(sorted([(score, id + 1) for (id, score) in enumerate(sum_arr)]))):
		if score == sum_arr[0]:
			return i + 1

def main():
	n = int(input())
	arr = list()
	for _ in range(n):
		arr.append(list(map(int, input().split())))
	print(solve(arr))
main()


n = int(input())
table = [0 for i in range(n + 1)]
for i in range(1, n + 1):
	studentgrades = tuple(map(int, input().split()))
	table[i] = sum(studentgrades)
rank = 1
while len(table) > 0:
	midx = 0
	for i in range(len(table)):
		if table[i] > table[midx]:
			midx = i
	if table[midx] > table[1]:
		rank += 1
		table.remove(table[midx])
	else:
		break
print(rank)


n = int(input())
(num, s_max, s) = (1, 0, 0)
for j in input().split():
	s_max += int(j)
for i in range(1, n):
	s = 0
	for j in input().split():
		s += int(j)
	if s > s_max:
		num += 1
print(num)


res = 1
n = int(input())
thomas = sum(list(map(int, input().split())))
for _ in range(n - 1):
	t = sum(list(map(int, input().split())))
	if t > thomas:
		res += 1
print(res)


n = int(input())
k = []
pas = 1
for i in range(n):
	a = list(map(int, input().split()))
	k.append(sum(a))
	if sum(a) > k[0]:
		pas += 1
print(pas)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
amount = int(f_input())
thomas = sum(map(int, f_input().split()))
place = 1
for i in range(1, amount):
	sum_ = sum(map(int, f_input().split()))
	if sum_ > thomas:
		place += 1
f_print(str(place))


n = int(input())
summ = []
for _ in range(n):
	Lists = list(map(int, input().split()))
	summ.append(sum(Lists))
val = summ[0]
summ.sort(reverse=True)
print(summ.index(val) + 1)


def main():
	n = int(input())
	scores = []
	for i in range(n):
		scores.append(list(map(int, input().rstrip().split())))
	s = list(map(sum, scores))
	print(sorted(s, reverse=True).index(s[0]) + 1)
main()


n = int(input())
rank = 1
thomas = 0
for i in range(n):
	m = list(map(int, input().split()))
	if i == 0:
		thomas = sum(m)
	elif sum(m) > thomas:
		rank += 1
print(rank)


def main():
	estudiantes = int(input(''))
	ce = estudiantes
	notaThomas = 0
	contador = 1
	notas = 0
	while ce > 0:
		nota = input('')
		no = calcularNota(nota)
		if ce == estudiantes:
			notaThomas = no
		elif no > notaThomas:
			contador += 1
		ce -= 1
	print(contador)

def calcularNota(x):
	lista = list(x)
	b1 = False
	b2 = False
	b3 = False
	nota = 0
	a = '0'
	b = '0'
	c = '0'
	d = '0'
	for x in range(len(lista)):
		if lista[x] != ' ' and b3 == True:
			d += lista[x]
		elif b1 and b2 and b3:
			break
		if lista[x] != ' ' and b2 == True and (b3 == False):
			c += lista[x]
		elif b1 and b2:
			b3 = True
		if lista[x] != ' ' and b1 == True and (b2 == False):
			b += lista[x]
		elif b1:
			b2 = True
		if lista[x] != ' ' and b1 == False:
			a += lista[x]
		else:
			b1 = True
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	return a + b + c + d
main()


n = int(input())
line = input().split(' ')
sumt = int(line[0]) + int(line[1]) + int(line[2]) + int(line[3])
k = 1
s = 0
for i in range(1, n):
	line = input().split(' ')
	s = int(line[0]) + int(line[1]) + int(line[2]) + int(line[3])
	if s > sumt:
		k += 1
print(k)


n = int(input())
data = []
for i in range(n):
	data.append(sum([int(a) for a in input().split()]))
t = data[0]
data = sorted(data, reverse=True)
print(data.index(t) + 1)


def main():
	n = int(input())
	data = [(id, tuple(map(int, input().split(' ')))) for id in range(1, n + 1)]
	data = sorted(data, key=lambda p: (500 - sum(p[1]), p[0]), reverse=False)
	for i in range(len(data)):
		if data[i][0] == 1:
			print(i + 1)
			break
exit(main())


s = int(input())
count = 0
score = []
tho = 0
while count < s:
	gr = input()
	gr = [int(x) for x in gr.split()]
	mark = sum(gr)
	if count == 0:
		tho += mark
	score.append(mark)
	count += 1
score = sorted(score)
for x in range(-1, -s - 1, -1):
	if score[x] == tho:
		print(x * -1)
		break


inp = int(input())
matrix = []
num = 1
for x in range(inp):
	grade = sum(map(int, input().split()))
	matrix.append(grade)
rank = matrix[0]
matrix = sorted(matrix, reverse=True)
for y in range(inp):
	if matrix[y] == rank:
		break
	num = num + 1
print(num)


n = int(input())
rank = 1
for i in range(n):
	arr = list(map(int, input().split(' ')))
	if i == 0:
		tom = sum(arr)
	else:
		s = sum(arr)
		if s > tom:
			rank += 1
print(rank)


n = int(input())
ai = [list(map(int, input().split())) for i in range(n)]
ai2 = [0] * n
for i in range(n):
	ai2[i] = sum(ai[i])
num = ai2[0]
ans = 1
for i in range(n):
	if num < ai2[i]:
		ans += 1
print(ans)


n = int(input())
for (i, (_, id)) in enumerate(sorted([(sum((int(x) for x in str(input()).split(' ', 3))), -(i + 1)) for i in range(n)], reverse=True), 1):
	if id == -1:
		print(i)
		break


a = [sum(map(int, input().split())) for i in [0] * int(input())]
k = sum((a[0] < i for i in a[1:]))
print(k + 1)


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(sum(m))
id = 1
for i in range(1, len(l)):
	if l[0] < l[i]:
		id += 1
print(id)


n = int(input())
lj = []
E = 0
G = 0
M = 0
H = 0
tot = 0
lt = []
for i in range(1):
	(E, G, M, H) = map(int, input().split())
	lj.append(E)
	lj.append(G)
	lj.append(M)
	lj.append(H)
for j in range(n - 1):
	(E, G, M, H) = map(int, input().split())
	tot = E + G + M + H
	lt.append(tot)
	tot = 0
	continue
jt = sum(lj)
lt.append(jt)
lt.sort()
lt.reverse()
print(lt.index(jt) + 1)


for i in range(int(input())):
	(a, b, c, d) = map(int, input().split())
	if i == 0:
		x = a + b + c + d
		co = 1
	else:
		x1 = a + b + c + d
		if x < x1:
			co += 1
print(co)


import sys

def main():
	inp = sys.stdin.read().strip().split('\n')
	s = sum(map(int, inp[1].split()))
	c = 1
	for x in inp[2:]:
		if sum(map(int, x.split())) > s:
			c += 1
	return c
print(main())


n = int(input())
l = []
for i in range(n):
	k = list(map(int, input().split()))
	l.append(k[0] + k[1] + k[2] + k[3])
rank = 1
for i in l:
	if i > l[0]:
		rank += 1
print(rank)


n = int(input())
l = []
for i in range(n):
	tp = [int(i) for i in input().split()]
	l.append(sum(tp))
t = l[0]
rank = 1
l.sort(reverse=True)
for i in l:
	if i != t:
		rank += 1
	else:
		print(rank)
		break


test = int(input())
dic = {}
for i in range(1, test + 1):
	lis = list(map(int, input().split()))
	dic[i] = sum(lis)
cmp = dic[1]
res = 1
for i in range(2, test + 1):
	if cmp < dic[i]:
		res = res + 1
print(res)


n = int(input())
l = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	l.append(a + b + c + d)
t = l[0]
l.sort(reverse=True)
i = l.index(t)
print(i + 1)


n = int(input())
s = []
for i in range(n):
	s.append(sum([int(i) for i in input().split()]))
print(sorted(s)[::-1].index(s[0]) + 1)


n = int(input())
a = input().split()
s = int(a[0]) + int(a[1]) + int(a[2]) + int(a[3])
x = 1
for i in range(1, n):
	a = input().split()
	if int(a[0]) + int(a[1]) + int(a[2]) + int(a[3]) > s:
		x += 1
print(x)


n = int(input())
li = []
for i in range(n):
	k = list(map(int, input().split()))
	li.append(sum(k))
s = li[0]
li = sorted(li, reverse=True)
for i in range(n):
	if li[i] == s:
		print(i + 1)
		break


a = int(input())
g = []
k = []
for i in range(a):
	b = list(map(int, input().split()))
	k.append(b)
	summa = sum(b)
	g.append(summa)
f = g[:]
tomas = f[0]
g.sort()
g.reverse()
tomas1 = g.index(tomas) + 1
print(tomas1)


def main():
	n = int(input())
	scores = []
	for i in range(n):
		a = list(map(int, input().split()))
		tot = sum(a)
		scores.append((-tot, i))
	scores.sort()
	for i in range(n):
		if scores[i][1] == 0:
			print(i + 1)
main()


n = int(input())
a = [[0] * 4] * n
k = []
t = 0
for i in range(n):
	a[i] = list(map(int, input().split()))
	if i == 0:
		t = sum(a[i])
	k.append(sum(a[i]))
k.sort(reverse=True)
print(k.index(t) + 1)


from collections import defaultdict as dc
n = int(input())
t = dc(int)
a = [int(i) for i in input().split()]
t[1] = sum(a)
for i in range(1, n):
	a = [int(i) for i in input().split()]
	t[i + 1] = sum(a)
t = dict(sorted(t.items(), key=lambda x: x[1], reverse=True))
c = 0
for i in t.keys():
	c += 1
	if i == 1:
		print(c)
		break


import functools

def p_a():
	line = input()
	(a, mean) = list(map(int, line.split(' ')))
	print(mean * 2 - a)

class p_b_data:

	def __init__(self):
		self.data = {}

	def compare(self, x, y):
		if self.data[x] < self.data[y]:
			return 1
		elif self.data[x] > self.data[y]:
			return -1
		else:
			if x < y:
				return -1
			return 1

def p_b():
	num_students = int(input())
	data = p_b_data()
	for i in range(num_students):
		score = sum(list(map(int, input().split(' '))))
		data.data[i] = score
	students = [i for i in range(num_students)]
	a = sorted(students, key=functools.cmp_to_key(data.compare))
	print(a.index(0) + 1)

def main():
	p_b()
main()


n = int(input())
l = []
c = 1
for i in range(n):
	s = list(map(int, input().split()))
	l.append(sum(s))
for i in range(len(l)):
	if l[i] > l[0]:
		c = c + 1
print(c)


n = int(input())
students = []
for i in range(n):
	a = [int(i) for i in input().split()]
	b = sum(a)
	c = [b, n - i]
	students.append(c)
students.sort()
students.reverse()
res = []
for i in students:
	res.append(i[1])
print(res.index(n) + 1)


n = int(input())
scores = []
thomas_score = 0
rank = 1
for i in range(n):
	score = sum(map(int, input().split(' ')))
	if i == 0:
		thomas_score = score
	elif score > thomas_score:
		rank += 1
print(rank)


n = int(input())
s = []
for i in range(1, n + 1):
	l = [int(i) for i in input().split()]
	s.append(sum(l))
h = sorted(s, reverse=True)
print(h.index(s[0]) + 1)


n = int(input())
s = []
rank = 1
for i in range(n):
	(a, b, c, d) = [int(x) for x in input().split()]
	s.append(a + b + c + d)
for j in range(1, n):
	if s[0] < s[j]:
		rank += 1
print(rank)


n = int(input())
sum_numbers_list = []
for i in range(n):
	score_line = input().split(' ')
	number_array = [int(num) for num in score_line]
	sum_numbers_list.append(sum(number_array))
sorted_list = sorted(sum_numbers_list)
sorted_list.reverse()
thomas = sum_numbers_list[0]
index_thomas = sorted_list.index(thomas) + 1
print(index_thomas)


n = int(input())
tomas = sum(map(int, input().split()))
t_id = 1
for i in range(n - 1):
	score = sum(map(int, input().split()))
	if score > tomas:
		t_id += 1
print(t_id)


n = int(input())
scores = []
for i in range(n):
	scores.append(sum(map(int, input().split())))
print(sorted(scores)[::-1].index(scores[0]) + 1)


l = []
for _ in range(int(input())):
	l.append(list(map(int, input().split())))
s = sum(l[0])
count = 1
for i in range(1, len(l)):
	if sum(l[i]) > s:
		count += 1
print(count)


n = int(input())
ans = []
t = 0
for i in range(n):
	a = sum([int(x) for x in input().split()])
	if i == 0:
		t = a
	ans.append(a)
ans.sort(reverse=True)
for i in range(n):
	if ans[i] == t:
		print(i + 1)
		break


n = int(input())
tmp = -1
ans = 1
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	if tmp == -1:
		tmp = a + b + c + d
	elif a + b + c + d > tmp:
		ans += 1
print(ans)


a = int(input())
score = []
for i in range(a):
	(p, q, r, s) = map(int, input().split())
	score.append(p + q + r + s)
t = score[0]
score.sort()
score.reverse()
print(score.index(t) + 1)


n = int(input())
m = []
for i in range(n):
	m1 = list(map(int, input().split()))
	m.append(sum(m1))
j = m[0]
m.sort()
m.reverse()
a = m.index(j)
print(a + 1)


USE_STDIO = False
if not USE_STDIO:
	try:
		import mypc
	except:
		pass

def main():
	(n,) = map(int, input().split(' '))
	scores = []
	for id in range(n):
		scores.append((-sum(map(int, input().split(' '))), id))
	scores.sort()
	for rank in range(n):
		if scores[rank][1] == 0:
			print(rank + 1)
			return
main()


n = int(input())
l = []
for i in range(n):
	(E, G, M, H) = map(int, input().split())
	s = E + G + M + H
	if i == 0:
		T = s
	l.append(s)
l.sort(reverse=True)
flag = 0
c = 0
while flag == 0:
	if l[c] == T:
		flag = 1
	c += 1
print(c)


a = int(input())
b = [i for i in range(0, a)]
for j in range(0, a):
	b[j] = list(map(int, input().split()))
f = []
for i in range(0, a):
	g = 0
	for j in range(0, 4):
		g = g + b[i][j]
	f.append(g)
h = list(f)
f.sort(reverse=True)
for y in range(0, a):
	if h[0] == f[y]:
		print(y + 1)
		break


n = int(input())
a = 0
for i in range(1):
	m = list(map(int, input().split()))
	x = sum(m)
for i in range(1, n):
	m = list(map(int, input().split()))
	if x < sum(m):
		a += 1
print(a + 1)


N = int(input())
ls = []
for i in range(N):
	ls.append(sum(map(int, input().split())))
Thomas = ls[0]
ls.sort(reverse=True)
print(ls.index(Thomas) + 1)


n = int(input())
x = []
for i in range(1, n + 1):
	(a, b, c, d) = map(int, input().split())
	t = a + b + c + d
	x.append([t, i])
x.sort(reverse=True)
for i in range(n):
	if x[i][1] == 1:
		tmp = x[i][0]
		tp = 0
		while i >= 0 and x[i][0] == tmp:
			tp = 1
			i -= 1
		if tp:
			print(i + 2)
		else:
			print(i + 1)


def key2(t):
	return t[1]
n = int(input())
student = []
for i in range(n):
	student.append((i + 1, sum(list(map(int, input().split())))))
student = sorted(student, key=key2, reverse=True)
for i in range(n):
	if student[i][0] == 1:
		print(i + 1)
		break


n = int(input())
ans = []
rank = 1
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	score = a + b + c + d
	ans.append(score)
for i in range(1, n):
	if ans[i] > ans[0]:
		rank += 1
print(rank)


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


n = int(input())
S = []
for i in range(n):
	X = [int(x) for x in input().split(' ')]
	S.append(sum(X))
x = S[0]
S.sort(reverse=True)
for i in range(n):
	if S[i] == x:
		print(i + 1)
		break


n = int(input())
mas = []
for i in range(n):
	mas1 = [int(x) for x in input().split()]
	mas.append(sum(mas1))
t = mas[0]
mas = sorted(mas)
mas.reverse()
print(mas.index(t) + 1)


n = int(input())
T = sum(map(int, input().split()))
ans = [T]
for i in range(n - 1):
	ans.append(sum(map(int, input().split())))
ans.sort(reverse=True)
print(ans.index(T) + 1)


a = int(input())
t = []
for i in range(a):
	t.append(sum(list(map(int, input().split()))))
ans = 1
for i in range(1, a):
	if t[i] > t[0]:
		ans = ans + 1
print(ans)


n = int(input())
towers = sum(list(map(int, input().split())))
place = 1
for i in range(n - 1):
	if sum(list(map(int, input().split()))) > towers:
		place += 1
print(place)


sc = [sum(map(int, input().split())) for _ in range(int(input()))]
print(sorted(sc)[::-1].index(sc[0]) + 1)


n = int(input())
ls = []
mx = 0
for i in range(n):
	sm = sum(list(map(int, input().split())))
	if i == 0:
		mx = sm
	ls.append(sm)
print(sorted(ls, reverse=True).index(mx) + 1)


z = int(input())
arr = []
for i in range(z):
	n = list(map(int, input().split()))
	arr.append(sum(n))
x = arr[0]
arr.sort(reverse=True)
print(arr.index(x) + 1)


n = int(input())
score = [sum([int(i) for i in input().split()]) for j in range(n)]
ans = 1
for i in range(n):
	if score[i] > score[0]:
		ans += 1
print(ans)


n = int(input())
l = []
for i in range(n):
	scores = [int(m) for m in input().split()]
	l.append(sum(scores))
num = l[0]
l = sorted(l)
l = l[::-1]
for j in range(len(l)):
	if l[j] == num:
		print(j + 1)
		break


n = int(input())
l = []
for i in range(n):
	m = list(map(int, input().split()))
	l.append(sum(m))
tomas = l.pop(0)
count = 0
c = len(l) - 1
while c >= 0:
	if tomas < l[c]:
		count += 1
	c -= 1
print(count + 1)


def getRank(grades):
	thomas_rank = 1
	thomas_grade = grades[0]
	for grade in grades:
		if thomas_grade < grade:
			thomas_rank += 1
	return thomas_rank
n = int(input())
grades = []
for i in range(n):
	grades.append(sum([int(x) for x in input().split()]))
print(getRank(grades))


n = int(input())
rank = 1
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	total = a + b + c + d
	if i == 0:
		ThomasTotal = total
		continue
	if total > ThomasTotal:
		rank += 1
print(rank)


q: int = int(input())

def sum_str(ints_str: str):
	return sum(map(int, ints_str.split()))
score_board = [sum_str(input()) for _ in range(q)]
thomas = score_board[0]
score_board = sorted(score_board, reverse=True)
print(score_board.index(thomas) + 1)


n = int(input())
a = []
r = 1
for i in range(n):
	b = []
	t = 0
	s = input()
	x = s.split()
	b = [int(y) for y in x]
	for i in range(4):
		t += b[i]
	a.append(t)
for i in range(n):
	if a[0] < a[i]:
		r += 1
print(r)


n = int(input())
b = {}
for i in range(n):
	b[i] = sum(map(int, input().split()))
a = sorted(b.values(), reverse=True)
print(a.index(b[0]) + 1)


n = int(input())
marks = []
m = []
count = 1
for i in range(n):
	m = list(map(int, input().split(' ')))
	marks.append(sum(m))
maxm = marks[0]
for i in range(1, n):
	if marks[i] > maxm:
		count += 1
print(count)


n = int(input())
mest = 1
summ = sum(list(map(int, input().split())))
for i in range(n - 1):
	if sum(list(map(int, input().split()))) > summ:
		mest += 1
print(mest)


n = int(input())
p = sorted([(-sum(map(int, input().split())), i) for i in range(n)])
for i in range(n):
	if p[i][1] == 0:
		print(i + 1)
		break


n = int(input())
c = 1
num = 0
for j in range(n):
	sum1 = sum(list(map(int, input().split(' '))))
	if j == 0:
		tho = sum1
	elif tho < sum1:
		c += 1
print(c)


m = dict()
a = dict()
for i in range(int(input())):
	m[i + 1] = list(map(int, input().split()))
for i in m:
	a[i] = sum(m[i])
a = sorted(a.items(), key=__import__('operator').itemgetter(1))[::-1]
a = [list(i) for i in a]
while True:
	c = 0
	for i in range(1, len(a)):
		if a[i - 1][1] == a[i][1] and a[i - 1][0] > a[i][0]:
			(a[i - 1][0], a[i][0]) = (a[i][0], a[i - 1][0])
			c += 1
	if not c:
		break
for i in range(len(a)):
	if a[i][0] == 1:
		print(i + 1)
		exit(0)


n = int(input())
total = []
for i in range(n):
	(e, g, m, h) = map(int, input().split())
	total.append((-(e + g + m + h), i + 1))
arr = sorted(total)
for (i, r) in enumerate(arr):
	if r[1] == 1:
		print(i + 1)


n = int(input())
s = [sum(map(int, input().split()))]
t = s[0]
for i in range(1, n):
	x = sum(map(int, input().split()))
	s.append(x)
s.sort(reverse=True)
for i in range(n - 1, -1, -1):
	if s[i] == t and (i == 0 or s[i - 1] > t):
		print(i + 1)
		exit()


n = int(input())
s = []
for i in range(n):
	a = list(map(int, input().split()))
	s.append(sum(a))
g = {}
for j in range(n):
	x = s.index(max(s)) + 1
	g[j + 1] = x
	s.remove(max(s))
	if x == 1:
		print(j + 1)
		break


n = int(input())
(a, b, c, d) = map(int, input().split())
score = a + b + c + d
rank = 1
for _ in range(n - 1):
	(a, b, c, d) = map(int, input().split())
	temp = a + b + c + d
	if temp > score:
		rank += 1
print(rank)


import sys
input = sys.stdin.readline
n = int(input())
k = sum(list(map(int, input().split())))
s = [k]
for i in range(1, n):
	s.append(sum(map(int, input().split())))
s.sort(reverse=True)
print(s.index(k) + 1)


a = []
for i in range(int(input())):
	a.append(sum(list(map(int, input().split()))))
t = a[0]
print(sorted(a, reverse=True).index(t) + 1)


def get_grade_sum(grade):
	sum = 0
	grades_str = grade.split(' ')
	for x in grades_str:
		sum = int(x) + sum
	return sum
no_of_students = int(input())
students = []
thomas_rank = 1
for x in range(0, no_of_students):
	students.append(int(get_grade_sum(input())))
for x in range(1, no_of_students):
	if students[0] < students[x]:
		thomas_rank = thomas_rank + 1
print(thomas_rank)


n = int(input())
x = []
for i in range(n):
	(x1, y1, z1, a1) = [int(i) for i in input().split()]
	x.append([x1 + y1 + z1 + a1, i + 1])
x = sorted(x, key=lambda x: -x[0])
for i in range(len(x)):
	if x[i][1] == 1:
		print(i + 1)
		break


n = int(input()) - 1
sf = sum(map(int, input().split()))
ans = 1
for _ in range(n):
	ans += sum(map(int, input().split())) > sf
print(ans)


x = int(input())
y = []
sums = []
rank = x
for c in range(x):
	y.append(list(map(int, input().split())))
for c in y:
	sums.append(c[0] + c[1] + c[2] + c[3])
for c in range(1, len(sums)):
	if sums[c] <= sums[0]:
		rank = rank - 1
print(rank)


n = int(input())
total = []
for _ in range(n):
	(e, g, m, h) = map(int, input().split())
	total.append(e + g + m + h)
id = list(range(1, n + 1))
for i in range(n):
	for j in range(i + 1, n):
		if total[i] < total[j]:
			(id[i], id[j]) = (id[j], id[i])
			(total[i], total[j]) = (total[j], total[i])
		elif total[i] == total[j]:
			if id[i] > id[j]:
				(id[i], id[j]) = (id[j], id[i])
				(total[i], total[j]) = (total[j], total[i])
			else:
				(total[i], total[j]) = (total[j], total[i])
rank = id.index(1) + 1
print(rank)


n = int(input())
data = []
for i in range(n):
	data.append([-1 * sum([int(x) for x in input().split()]), i + 1])
data.sort()
for i in range(len(data)):
	if data[i][1] == 1:
		print(i + 1)


n = int(input())
value = sum([int(x) for x in input().split()])
rank = 1
for i in range(n - 1):
	if value < sum([int(x) for x in input().split()]):
		rank += 1
print(rank)


n = int(input())
my_son = sum(list(map(int, input().split())))
result = 1
for i in range(n - 1):
	if sum(list(map(int, input().split()))) > my_son:
		result += 1
print(result)


ar1 = input()
lol = []
i = 0
summ = 0
summ1 = 0
rait = 1
lol = str(input()).split()
summ = summ + int(lol[0]) + int(lol[1]) + int(lol[2]) + int(lol[3])
while i < int(ar1) - 1:
	lol = str(input()).split()
	summ1 = summ1 + int(lol[0]) + int(lol[1]) + int(lol[2]) + int(lol[3])
	if summ1 > summ:
		rait += 1
	summ1 = 0
	i += 1
print(rait)


c = 0
count = 1
for i in range(int(input())):
	ar = list(map(int, input().split()))
	if i == 0:
		c = sum(ar)
	elif sum(ar) > c:
		count += 1
print(count)


n = int(input())
lst = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	lst.append(a + b + c + d)
print(sum((x > lst[0] for x in lst[1:])) + 1)


n = int(input())
matrix = []
point_arr = []
for i in range(n):
	point = 0
	matrix = [int(i) for i in input().split()]
	for j in matrix:
		point += j
	point_arr.append(point)
rank = 1
for i in point_arr:
	if i > point_arr[0]:
		rank += 1
print(rank)


n = int(input())
score = sum(map(int, input().split()))
ans = 1
for x in range(n - 1):
	if sum(map(int, input().split())) > score:
		ans += 1
print(ans)


n = int(input())
l1 = []
l2 = []
a = 0
for i in range(n):
	l = list(map(int, input().split()))
	s = l[0] + l[1] + l[2] + l[3]
	l1.append(s)
	l2.append(s)
l2.sort(reverse=True)
for i in range(n):
	if l1[0] == l2[i]:
		a = i + 1
		break
print(a)


n_students = int(input())
sums = {i: 0 for i in range(n_students)}
for i in range(n_students):
	sums[i] = sum(list(map(int, input().split())))
ranking = sorted(list(sums.values()), reverse=True)
print(ranking.index(sums[0]) + 1)


n = int(input())
data = input().split(' ')
sonsum = sum([int(data[i]) for i in range(0, 4)])
arr = [sonsum]
for i in range(1, n):
	data = input().split(' ')
	pl = sum([int(data[i]) for i in range(0, 4)])
	j = 0
	while j < i and arr[j] >= pl:
		j += 1
	if j == i:
		arr += [pl]
	else:
		arr += [0]
		for l in range(i - 1, j - 1, -1):
			arr[l + 1] = arr[l]
		arr[j] = pl
res = 0
for i in range(0, n):
	if arr[i] == sonsum:
		res = i + 1
		break
print(res)


n = int(input())
t = sum(map(int, input().split()))
print(sum((sum(map(int, input().split())) > t for i in range(n - 1))) + 1)


def ii():
	return list(map(int, input().split()))
n = int(input())
s = []
for i in range(n):
	s.append((-sum(ii()), i))
target = s[0]
print(sorted(s).index(target) + 1)


import bisect

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i

def find_le(a, x):
	i = bisect.bisect_right(a, x)
	if i:
		return i - 1
t = int(input())
x = sum(list(map(int, input().strip().split())))
arr = []
arr.append(x)
for i in range(t - 1):
	arr.append(sum(list(map(int, input().strip().split()))))
arr = sorted(arr)
op = len(arr) - find_le(arr, x)
print(op)


x = int(input())
a = []
sum = 0
sum1 = 0
for i in range(1, x + 1):
	(p, q, r, s) = map(int, input().split())
	sum = p + q + r + s
	if i == 1:
		sum1 = sum
	a.append(sum)
a.sort(reverse=True)
d = a.index(sum1) + 1
print(d)


n = int(input())
sm = sum(list(map(int, input().split())))
rnk = 1
for i in range(n - 1):
	if sum(list(map(int, input().split()))) > sm:
		rnk += 1
print(rnk)


n = int(input())
n_tom = 0
list_child = []
str_child = input()
for j in range(4):
	n_tom += int(str_child.split()[j])
list_child.append(n_tom)
for i in range(n - 1):
	str_child = input()
	n_child = 0
	for j in range(4):
		n_child += int(str_child.split()[j])
	list_child.append(n_child)
list_child.sort()
for i in range(n):
	if list_child[n - i - 1] == n_tom:
		print(i + 1)
		break


rank = 1
j = input
n = int(j()) - 1
c = sum(list(map(int, input().split())))
for i in range(n):
	if sum(list(map(int, input().split()))) > c:
		rank += 1
print(rank)


n = int(input())
s = []
c = 1
for i in range(n):
	z = [int(i) for i in input().split()]
	s.append(z)
for i in range(n):
	if sum(s[0]) >= sum(s[i]):
		pass
	else:
		c += 1
print(c)


num_students = int(input())
students_scores = []
for i in range(num_students):
	scores = input()
	score1 = int(scores[:scores.find(' ')])
	scores = scores[scores.find(' ') + 1:]
	score2 = int(scores[:scores.find(' ')])
	scores = scores[scores.find(' ') + 1:]
	score3 = int(scores[:scores.find(' ')])
	score4 = int(scores[scores.find(' ') + 1:])
	sum_scores = score1 + score2 + score3 + score4
	students_scores += [sum_scores]
rank = 1
for j in students_scores:
	if j > students_scores[0]:
		rank += 1
print(rank)


count = int(input())
grades = [sum(map(int, input().split())) for k in range(count)]
print(len(list((x for x in grades if x > grades[0]))) + 1)


n = int(input())
l = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	l.append([-(a + b + c + d), i])
l = sorted(l)
for i in range(n):
	if l[i][1] == 0:
		print(i + 1)
		exit()


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

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
n = I()
b = []
for i in range(n):
	a = L()
	b.append(tuple([-sum(a), i]))
b.sort()
for k in range(len(b)):
	(i, j) = b[k]
	if j == 0:
		print(k + 1)
		exit()


n = int(input())
sum = sum1 = 0
x = 2
(a, b, c, d) = [int(i) for i in input().split()]
Sum = a + b + c + d
rank = 1
while x <= n:
	(a1, b1, c1, d1) = [int(i) for i in input().split()]
	sum1 = a1 + b1 + c1 + d1
	if sum1 > Sum:
		rank += 1
	x += 1
print(rank)


a = []
for _ in range(int(input())):
	p = 0
	for o in input().split():
		p += int(o)
	a.append(p)
c = a[0]
a = sorted(a, reverse=True)
print(a.index(c) + 1)


(li, index) = (list([]), 0)
for _ in range(int(input())):
	li.append(sum([int(x) for x in input().split()]))
smith = li[0]
li.sort(reverse=True)
print(li.index(smith) + 1)


n = int(input())
j = sum(list(map(int, input().split())))
count = 0
for i in range(n - 1):
	if sum(list(map(int, input().split()))) > j:
		count += 1
print(count + 1)


x = int(input())
z = []
for i in range(x):
	y = list(map(int, input().split()))
	z.append(y)
k = 1
for i in range(1, x):
	if sum(z[i]) > sum(z[0]):
		k = k + 1
print(k)


def main():
	N = int(input())
	A = []
	for (i, _) in enumerate(range(N)):
		(a, b, c, d) = [int(e) for e in input().split(' ')]
		A.append((-(a + b + c + d), i + 1))
	A.sort()
	for i in range(N):
		if A[i][1] == 1:
			print(i + 1)
main()


a = []
t = int(input())
for i in range(t):
	(e, b, c, d) = map(int, input().split())
	a.append(e + b + c + d)
p = 0
for i in range(1, t):
	if a[i] > a[0]:
		p += 1
print(p + 1)


n = int(input())
sums = []
for i in range(n):
	kek = list(map(int, input().split()))
	sums.append(sum(kek))
	kek = []
sun = sums[0]
sums.sort()
sums.reverse()
print(sums.index(sun) + 1)


n = int(input())
l = []
for i in range(n):
	l1 = list(map(int, input().split()))
	c = 0
	for i in l1:
		c += i
	l.append(c)
x = l[0]
l.sort()
l.reverse()
for i in range(len(l)):
	if l[i] == x:
		print(i + 1)
		break


n = int(input())
q = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	s = a + b + c + d
	q.append(s)
r = q.copy()
r.sort()
r.reverse()
m = r.index(q[0])
print(m + 1)


from collections import deque, Counter
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
n = read_int()
a = [[int(e) for e in input().strip().split(' ')] + [id] for id in range(1, n + 1)]
a.sort(key=lambda e: (-sum(e[:-1]), e[-1]))
print(1 + list((e[-1] for e in a)).index(1))


n = int(input())
l = [sum(list(map(int, input().split()))) for i in range(n)]
print(sorted(l, reverse=1).index(l[0]) + 1)


n = int(input())
l = []
for i in range(n):
	a = list(map(int, input().split()))
	sum = 0
	for i in range(4):
		sum = sum + a[i]
	l.append(sum)
b = l[0]
l.sort(reverse=True)
print(l.index(b) + 1)


n = int(input())
students = []
sums = []
for i in range(n):
	students.append([int(j) for j in input().split()])
for i in range(1, n):
	sums.append(sum(students[i]))
sums.sort(reverse=True)
result = n
maxSum = sum(students[0])
for i in range(n - 1):
	if maxSum >= sums[i]:
		result = i + 1
		break
print(result)


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
a = []
(n,) = q()
d = sum(q())
a.append(d)
for _ in [0] * (n - 1):
	a.append(sum(q()))
print(sorted(a, reverse=True).index(d) + 1)


n = int(input())
c = 1
s = []
for i in range(n):
	p = [int(x) for x in input().split()]
	s.append(sum(p))
while p != n:
	if max(s) > s[0]:
		s.remove(max(s))
		c = c + 1
	else:
		print(c)
		exit()


n = int(input())
results = []
for i in range(n):
	results.append(sum(map(int, input().split())))
more = 0
own_result = results[0]
for i in range(1, len(results)):
	if own_result < results[i]:
		more += 1
print(more + 1)


n = int(input())
sl = []
th = 0
for i in range(n):
	tl = list(map(int, input().split()))
	if i == 0:
		th = sum(tl)
	sl += [sum(tl)]
sl.sort()
sl.reverse()
ans = 1
for i in range(n):
	if sl[i] == th:
		break
	else:
		ans += 1
print(ans)


n = int(input())
x = []
for i in range(n):
	a = list(map(int, input().split()))
	a.append(i + 1)
	x.append(a)
x.sort(key=lambda x: [-sum(x[:4]), x[4]])
for i in range(n):
	if x[i][4] == 1:
		print(i + 1)
		exit(0)


def test_0():
	import math
	from collections import Counter
	n = list(map(int, input().split(' ')))[0]
	data = []
	for i in range(n):
		data_1 = list(map(int, input().split(' ')))
		data.append(sum(data_1))
	idx = sorted(range(len(data)), key=lambda k: data[k], reverse=1)
	idx_2 = sorted(range(len(idx)), key=lambda k: idx[k])
	print(idx_2[0] + 1)
test_0()


n = int(input())
arr = [(i + 1, sum(map(int, input().split()))) for i in range(n)]
arr.sort(key=lambda x: (x[1], -x[0]), reverse=True)
for i in range(n):
	if arr[i][0] == 1:
		print(i + 1)


n = int(input())
L = []
for i in range(n):
	sum_ = sum([int(j) for j in input().split()])
	L.append([sum_, i])
S = L[0][0]
L.sort(reverse=True)
for i in range(n):
	if L[i][0] == S:
		print(i + 1)
		break


n = int(input())
a = []
b = []
c = []
d = []
r = 1
for i in range(n):
	(x, y, z, w) = map(int, input().split())
	a.append(x)
	b.append(y)
	c.append(z)
	d.append(w)
	if i == 0:
		s = x + y + z + w
	if x + y + z + w > s:
		r += 1
print(r)


n = int(input())
l = []
for i in range(n):
	l.append(sum(list(map(int, input().split()))))
t = l[0]
l = sorted(l)
l = l[::-1]
m = [l[j] for j in range(len(l)) if l[j] > t]
print(len(m) + 1)


def rank(ls):
	for i in range(len(ls)):
		ls[i] = sum(ls[i])
	ind = ls.index(max(ls))
	c = 1
	while ind != 0:
		ls[ind] = -1
		ind = ls.index(max(ls))
		c = c + 1
	return c
n = int(input())
ls = [[int(j) for j in input().split()] for i in range(n)]
print(rank(ls))


from sys import stdin, stdout
n = int(stdin.readline())
thomas = sum(map(int, stdin.readline().split()))
marks = [sum(map(int, line.split())) for line in stdin]
rank = 1
for mark in marks:
	if mark > thomas:
		rank += 1
stdout.write(str(rank))


a = int(input())
b = input().split()
c = int(b[0]) + int(b[1]) + int(b[2]) + int(b[3])
o = 1
for i in range(a - 1):
	b = input().split()
	n = int(b[0]) + int(b[1]) + int(b[2]) + int(b[3])
	if n > c:
		o += 1
print(o)


n = int(input())
thomasSmith = 0
count = 0
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	sums = a + b + c + d
	if i == 0:
		thomasSmith = sums
		count += 1
	elif sums > thomasSmith:
		count += 1
print(count)


n = int(input())
rank = 1
val = sum(list(map(int, input().split(' '))))
for _ in range(n - 1):
	val1 = sum(list(map(int, input().split(' '))))
	if val1 > val:
		rank += 1
print(rank)


n = int(input())
S = []
for i in range(n):
	A = [int(i) for i in input().split()]
	S.append(sum(A))
if S[0] == max(S):
	print('1')
	exit()
thomas = S[0]
rank = 1
S.sort(reverse=True)
for i in S:
	if i == thomas:
		print(rank)
		break
	else:
		rank += 1


a = []
for i in range(int(input())):
	ls = [*map(int, input().split())]
	a.append(sum(ls))
tmp = a[0]
a.sort(reverse=True)
print(a.index(tmp) + 1)


n = int(input())
s = []
for i in range(1, n + 1):
	s.append(sum(map(int, input().split())))
ts = s[0]
s = sorted(s)
s.reverse()
print(s.index(ts) + 1)


list = []
n = int(input())
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	list.append(a + b + c + d)
t = list[0]
list.sort(reverse=True)
print(list.index(t) + 1)


class student:

	def __init__(self, id, english, german, math, history):
		self.id = id
		self.english = english
		self.german = german
		self.math = math
		self.history = history

	def sum(self):
		self.sum1 = self.english + self.german + self.math + self.history
		return self.sum1
n = int(input())
s = input()
list_students = []
scores = s.split()
thomas = student(1, int(scores[0]), int(scores[1]), int(scores[2]), int(scores[3]))
list_students.append(thomas)
for i in range(2, n + 1):
	s = input()
	scores = s.split()
	if int(scores[0]) + int(scores[1]) + int(scores[2]) + int(scores[3]) > thomas.sum():
		list_students.append(student(i, int(scores[0]), int(scores[1]), int(scores[2]), int(scores[3])))
list_students.sort(key=lambda student1: student1.sum())
list_students.reverse()
for l in range(0, len(list_students) - 1):
	check_list = []
	while list_students[l].sum() == list_students[l + 1].sum() and l < len(list_students) - 1:
		check_list.append(l)
		check_list.append(l + 1)
		l += 1
	if len(check_list) != 0:
		check_list_list = list_students[check_list[0]:check_list[-1] + 1]
		check_list_list.sort(key=lambda student2: student2.id)
		for i in range(0, len(check_list_list)):
			list_students[check_list[0] + i] = check_list_list[i]
for k in range(0, len(list_students)):
	if list_students[k].id == 1:
		print(k + 1)
		break


n = int(input())
l = [0]
l1 = [0]
for x in range(n):
	l.append(input().split())
	l1.append(sum((int(i) for i in l[x + 1])))
for x in range(2, len(l1)):
	if l1[1] == l1[x]:
		l1[x] = -1
s = l1[1]
l1.sort()
for x in range(1, n + 1):
	if s == l1[-x]:
		print(x)
		break


n = int(input())
d = []
for i in range(0, n):
	s = input()
	s = s.split()
	temp = 0
	for x in s:
		temp += int(x)
	d.append(temp)
temp = d[0]
count = 0
for x in d:
	if x > temp:
		count += 1
print(count + 1)


import sys
import math
n = int(input())
coma = [0 for i in range(n)]
for i in range(n):
	lista = [int(y) for y in input().strip().split()]
	suma = sum(lista)
	coma[i] += suma
	if i == 0:
		dave = suma
coma = sorted(coma, reverse=True)
print(coma.index(dave) + 1)


N = int(input(''))
list_sum = []
for ids in range(0, N):
	scores = str(input(''))
	scores_list = scores.split(' ')
	sum1 = 0
	for score in scores_list:
		sum1 = sum1 + int(score)
	if ids == 0:
		son_score = sum1
	list_sum.append(sum1)
list_sum.sort(reverse=True)
rank = list_sum.index(son_score) + 1
print(rank)


n = int(input())
x = []
for i in range(1, n + 1):
	sum = 0
	(e, g, m, h) = map(int, input().split())
	sum = e + g + h + m
	if i == 1:
		s = e + g + h + m
	x.append(sum)
x.sort(reverse=True)
for i in range(n):
	if x[i] == s:
		print(i + 1)
		break


__author__ = '#miner'
(rate, n) = (1, int(input()))
a = sum((i for i in list(map(int, input().split()))))
for i in range(n - 1):
	if sum((i for i in list(map(int, input().split())))) > a:
		rate += 1
print(rate)


n = int(input())
l1 = []
for i in range(n):
	l = list(map(int, input().split()))
	sum1 = 0
	for y in l:
		sum1 = sum1 + y
	l1.append(sum1)
if l1[0] == max(l1):
	rank = 1
else:
	max1 = l1[0]
	rank = 1
	for y in range(1, n):
		if l1[y] > max1:
			rank = rank + 1
print(rank)


H = lambda : map(int, input().split())
TOMAS_RANK = 1
N = int(input())
SUM = sum(H())
for _ in range(N - 1):
	if SUM < sum(H()):
		TOMAS_RANK += 1
print(TOMAS_RANK)


n = int(input())
gradesTotal = [None] * n

def sumGrades(strGrades):
	sum = 0
	listGrades = strGrades.split()
	for (idx, grade) in enumerate(listGrades):
		sum = sum + int(grade)
	return sum
for k in range(n):
	gradesTotal[k] = sumGrades(input())
c = 1
res = 1
while c < len(gradesTotal):
	if gradesTotal[c] > gradesTotal[0]:
		res += 1
	c += 1
print(res)


n = int(input())
(a, b, c, d) = map(int, input().split(' '))
sum = a + b + c + d
rez = 1
for i in range(1, n):
	(a, b, c, d) = map(int, input().split(' '))
	s = a + b + c + d
	if s > sum:
		rez += 1
print(rez)


n = int(input())
b = {}
rank = 1
for i in range(n):
	a = list(map(int, input().split()))
	b[i] = sum(a)
for i in range(1, n):
	if b[i] > b[0]:
		rank += 1
print(rank)


Rank = 1
for i in range(int(input())):
	A = list(map(int, input().split()))
	if i == 0:
		M = sum(A)
	elif sum(A) > M:
		Rank += 1
print(Rank)


n = int(input())
arr = [(0, 0)] * n
for i in range(n):
	a = sum(list(map(int, input().split())))
	arr[i] = (-a, i)
arr.sort()
for i in range(n):
	if arr[i][1] == 0:
		print(i + 1)


n = int(input())
r = 0
k = 0
m = list()
s = str()
l = list()
for i in range(n):
	s = 0
	b = input().split()
	for j in range(4):
		s += int(b[j])
	m.append(s)
w = m[0]
m.sort()
m.reverse()
for i in range(len(m)):
	if m[i] == w:
		print(i + 1)
		break


a = []
for i in range(int(input())):
	b = str(input()).split()
	a.append(int(b[0]) + int(b[1]) + int(b[2]) + int(b[3]))
x = a[0]
a.sort(reverse=True)
for i in range(len(a)):
	if x == a[i]:
		print(i + 1)
		break


n = int(input())
L = [[0, i] for i in range(1, n + 1)]
for i in range(n):
	L[i][0] = -sum(list(map(int, input().split())))
L.sort()
for i in range(n):
	if L[i][1] == 1:
		print(i + 1)
		break


n = int(input())
scoreSums = []
thomasScore = sum([int(x) for x in input().split()])
scoreSums.append(thomasScore)
for i in range(n - 1):
	scoreSums.append(sum([int(x) for x in input().split()]))
scoreSums.sort(reverse=True)
print(scoreSums.index(thomasScore) + 1)


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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:
			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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def input():
	return stdin.readline().strip()

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : map(int, z().split()))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
n = int(z())
lst = []
me = sum(zzz())
for i in range(n - 1):
	lst.append(sum(zzz()))
lst = sorted(lst)
print(n - bisect(lst, me))


numero_estudiantes = int(input())
estudiantes = {}
for i in range(1, numero_estudiantes + 1):
	estudiantes[i] = sum(list(map(int, input().split())))
print(sorted(estudiantes.values(), reverse=True).index(estudiantes.get(1)) + 1)


n = int(input())
scores = []
for _ in range(n):
	scores.append(sum(list(map(int, input().split()))))
thomas_place = 1
thomas_score = scores[0]
for i in range(1, n):
	if scores[i] > thomas_score:
		thomas_place += 1
print(thomas_place)


n = int(input())
l = list(map(int, input().split()))
r = 1
for i in range(2, n + 1):
	li = list(map(int, input().split()))
	if sum(li) > sum(l):
		r += 1
print(r)


n = int(input())
m = []
j = 1
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	s = a + b + c + d
	m.append(s)
k = m[0]
m.pop(0)
m.sort()
for i in range(len(m)):
	if k < m[i]:
		j += 1
print(j)


total_students = int(input())
student_scores = {}
for i in range(1, total_students + 1):
	total_score = sum([int(x) for x in input().split()])
	student_scores[i] = total_score
student_scores = dict(sorted(student_scores.items(), key=lambda item: item[1], reverse=True))
ids = list(student_scores.keys())
thomas_rank = ids.index(1) + 1
print(thomas_rank)


n = int(input())
a = []
for i in range(n):
	a.append(sum((int(x) for x in input().split())))
ans = 1
for i in range(1, n):
	if a[i] > a[0]:
		ans += 1
print(ans)


n = int(input())
x = []
syn = 0
for i in range(n):
	x.append(sum([int(j) for j in input().split()]))
syn = x[0]
x = sorted(x)[::-1]
print(x.index(syn) + 1)


a = []
for i in range(int(input())):
	a.append([int(j) for j in input().split()])
b = [sum(i) for i in a]
t = b[0]
c = sorted(b)[::-1]
print(c.index(t) + 1)


a = int(input())
o = 1
m = sum(list(map(int, input().split())))
for i in range(a - 1):
	if sum(list(map(int, input().split()))) > m:
		o += 1
print(o)


n = int(input())
l = [sum(map(int, input().split())) for _ in range(n)]
tom = l[0]
z = 1
for i in range(1, n):
	if l[i] > tom:
		z += 1
print(z)


nums = input()
nums = int(nums)
l = []
for i in range(nums):
	k = map(int, input().split(' '))
	ks = sum(k)
	l.append(ks)
thomas = l[0]
max_scores = max(l)
counts = l.count(thomas)
l = sorted(l)
l = l[::-1]
thomas_index = l.index(thomas)
print(thomas_index + 1)


t = int(input())
thomas = sum(list(map(int, input().split())))
cnt = 1
for i in range(t - 1):
	s = sum(list(map(int, input().split())))
	if s > thomas:
		cnt += 1
print(cnt)


n = int(input())
rt = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	rt.append([a + b + c + d, -i])
rt.sort()
for i in range(n):
	if rt[i][1] == 0:
		print(n - i)
		break


n = int(input())
s = 0
sa = []
s1 = 0
for i in range(n):
	s = 0
	a = [int(t) for t in input().split(' ')]
	for j in range(len(a)):
		s += a[j]
	sa.append(s)
	if i == 0:
		s1 = s
sa = sorted(sa)[::-1]
print(sa.index(s1) + 1)


n = int(input())
l = []
for i in range(n):
	a = list(map(int, input().split()))
	l.append(sum(a))
s = l[0]
l.sort()
l.reverse()
print(l.index(s) + 1)


n = int(input())
a = [int(i) for i in input().split()]
s = sum(a)
b = []
b.append(s)
for i in range(1, n):
	a = [int(i) for i in input().split()]
	m = sum(a)
	b.append(m)
b.sort(reverse=True)
for i in range(0, n):
	if b[i] == s:
		break
print(i + 1)


def prog():
	from sys import stdin
	n = int(stdin.readline())
	(a, b, c, d) = map(int, stdin.readline().split())
	dano = a + b + c + d
	rez = 1
	for i in range(1, n):
		(a, b, c, d) = map(int, stdin.readline().split())
		q = a + b + c + d
		if q > dano:
			rez += 1
	print(rez)
prog()


t = int(input())
li = []
for _ in range(t):
	(a, b, c, d) = map(int, input().split())
	y = a + b + c + d
	li.append(y)
x = li[0]
li.sort(reverse=True)
print(li.index(x) + 1)


n = int(input())
x = []
q = 0
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	if i == 0:
		q = a + b + c + d
	x.append(a + b + c + d)
x.sort(reverse=1)
for i in range(len(x)):
	if x[i] == q:
		print(i + 1)
		break


n = int(input().strip())
son = sum(list(map(int, input().strip().split())))
behind = 0
t = 0
for _ in range(1, n):
	if sum(list(map(int, input().split()))) > son:
		behind += 1
print(behind + 1)


l = []
n = int(input())
for _ in range(n):
	l.append(sum(list(map(int, input().split()))))
m = l[0]
l.sort()
l.reverse()
print(l.index(m) + 1)


n = int(input())
M = [list(map(int, input().split())) for i in range(n)]
J = []
for i in M:
	x = sum(i)
	J.append(x)
x = 1
for i in range(len(J)):
	if J[0] < J[i]:
		x += 1
print(x)


n = int(input())
ans = 0
su = -1
while n > 0:
	n = n - 1
	(a, b, c, d) = input().split()
	(a, b, c, d) = [int(a), int(b), int(c), int(d)]
	if su == -1:
		su = a + b + c + d
	elif a + b + c + d > su:
		ans = ans + 1
print(ans + 1)


n = int(input())
A = sum(map(int, input().split()))
S = []
for i in range(n - 1):
	S.append(sum(map(int, input().split())))
S.sort()
S.reverse()
for i in range(n - 1):
	if A >= S[i]:
		print(i + 1)
		exit()
print(n)


n = int(input())
l1 = list(map(int, input().split()))
k = sum(l1)
c = 1
for i in range(n - 1):
	l = list(map(int, input().split()))
	if sum(l) > k:
		c += 1
print(c)


j = int(input())
k = []
for i in range(j):
	(a, b, c, d) = map(int, input().split())
	k.append(a + b + c + d)
t = k[0]
k.sort(reverse=True)
f = 0
for i in range(j):
	if k[i] == t:
		f = i
		break
print(f + 1)


n = int(input())
k = 0
v = []
for i in range(n):
	b = list(map(int, input().split()))
	if i == 0:
		k = sum(b)
	v.append(sum(b))
v.sort()
v.reverse()
print(v.index(k) + 1)


n = int(input())
(a, b, c, d) = [int(x) for x in input().split()]
s = a + b + c + d
j = 1
for i in range(n - 1):
	(a, b, c, d) = [int(x) for x in input().split()]
	ss = a + b + c + d
	if ss > s:
		j += 1
print(j)


z = int(input())
g = 0
n = []
for i in range(z):
	(x, c, v, b) = list(map(int, input().split()))
	n.append(x + c + v + b)
for j in range(len(n)):
	if n[j] > n[0]:
		g += 1
if g > 0:
	print(g + 1)
else:
	print(1)


n = int(input())
score_list = []
for i in range(1, n + 1):
	(a, b, c, d) = map(int, input().split())
	if i == 1:
		score_thomas = a + b + c + d
	score_list.append(a + b + c + d)
score_list.sort(reverse=True)
print(score_list.index(score_thomas) + 1)


n = int(input())
v = [sum(map(int, input().split())) for i in range(n)]
print(len(list((i for i in v if i > v[0]))) + 1)


n = int(input())
y = list(map(int, input().split()))
a = y[0] + y[1] + y[2] + y[3]
rank = 1
for i in range(0, n - 1):
	x = list(map(int, input().split()))
	b = x[0] + x[1] + x[2] + x[3]
	if b > a:
		rank = rank + 1
print(rank)


m = []
for i in range(int(input())):
	l = list(map(int, input().split()))
	m.append(sum(l))
k = sorted(m, reverse=True)
print(k.index(m[0]) + 1)


n = int(input())
scores = []
score = -1
for t in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	scores.append(a + b + c + d)
	if t == 0:
		score = a + b + c + d
scores.sort(reverse=True)
print(scores.index(score) + 1)


n = int(input())
scores = []
rank = 1
while n > 0:
	(a, b, c, d) = map(int, input().split())
	Sum = a + b + c + d
	scores.append(Sum)
	n -= 1
thomas = scores[0]
while max(scores) != thomas:
	scores.remove(max(scores))
	rank += 1
print(rank)


l = []
for _ in range(int(input())):
	l.append(sum([int(x) for x in input().split()]))
print(sorted(l, reverse=True).index(l[0]) + 1)


thomas = 0
rank = 1
for i in range(int(input())):
	if i == 0:
		thomas = sum(map(int, input().split()))
	else:
		score = sum(map(int, input().split()))
		if score > thomas:
			rank += 1
print(rank)


n = int(input())
results = []
for i in range(n):
	results.append(sum([int(x) for x in input().strip().split(' ')]))
rank = 1
for i in range(1, n):
	if results[i] > results[0]:
		rank += 1
print(rank)


import bisect
n = int(input())
studentsScores = {}
for id in range(1, n + 1):
	scores = list(map(int, input().split()))
	studentsScores[id] = sum(scores)
studentsRanking = sorted(studentsScores, key=studentsScores.get, reverse=True)
bisect.insort(studentsRanking, 0)
print(studentsRanking.index(1))


a = int(input())
arr1 = list(map(int, input().split()))
s = sum(arr1)
l = 1
for i in range(a - 1):
	arr = list(map(int, input().split()))
	if s < sum(arr):
		l += 1
print(l)


n = int(input())
ans = []
val = int
for i in range(n):
	f = list(map(int, input().split()))
	ans.append(sum(f))
	if i == 0:
		val = sum(f)
ans.sort(reverse=True)
print(ans.index(val) + 1)


n = int(input(''))
a = [0] * n
for i in range(n):
	entrada = input('').split()
	a[i] = sum((int(entrada[x]) for x in range(len(entrada))))
john = a[0]
a.sort(reverse=True)
minimo = min((i for i in range(len(a)) if a[i] == john))
print(str(minimo + 1))


x = int(input())
y = []
for i in range(x):
	y.append(list(map(int, input().split(' '))))
z = y[:]
a = [sum(i) for i in y]
a.sort(reverse=True)
if sum(z[0]) in a:
	print(a.index(sum(z[0])) + 1)
else:
	pass


no_of_stds = int(input())
marks = [sum(list(map(int, input().split()))) for i in range(no_of_stds)]
ranking = sorted(marks)[::-1]
print(ranking.index(marks[0]) + 1)


l = []
for i in range(int(input())):
	l.append(sum(list(map(int, input().split()))))
c = l[0]
r = 1
for i in l[1:]:
	if i > c:
		r += 1
print(r)


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 = I()
	a = sorted([(-sum(LI()), i) for i in range(n)])
	for i in range(n):
		if a[i][1] == 0:
			return i + 1
	return -1
print(main())


from operator import itemgetter
n = int(input())
egmh = [list(map(int, input().split())) for _ in range(n)]
sums = [sum(egmh[i]) for i in range(n)]
num = sums[0]
sums.sort(reverse=True)
for i in range(n):
	if sums[i] == num:
		print(i + 1)
		break


lst = [[sum(map(int, input().split())), i] for i in range(int(input()))]
print(sorted(lst, key=lambda a: a[0], reverse=True).index(lst[0]) + 1)


N = int(input())
Arr1 = sum(list(map(int, input().split())))
L = [Arr1]
Res = 1
for i in range(N - 1):
	Arr = sum(list(map(int, input().split())))
	if Arr > Arr1:
		Res += 1
print(Res)


n = int(input())
l = [(-sum(map(int, input().split())), i) for i in range(n)]
TomasSmith = l[0]
l.sort()
print(l.index(TomasSmith) + 1)


def main():
	n = int(input())
	data = []
	for i in range(n):
		data.append(list(map(int, input().split())))
	add = sum(data[0])
	position = 1
	for i in range(1, n):
		if add < sum(data[i]):
			position += 1
	print(position)
main()


n = int(input())
sm = list(map(int, input().split()))
S1 = sum(sm)
L = [S1]
for i in range(n - 1):
	s = list(map(int, input().split()))
	S = sum(s)
	if S in L:
		S -= 0.0001
	L += [S]
L = sorted(L, reverse=True)
print(L.index(S1) + 1)


n = int(input())
tom = sum(list(map(int, input().split())))
l = []
l.append(tom)
for i in range(n - 1):
	pers = sum(list(map(int, input().split())))
	l.append(pers)
l.sort(reverse=True)
for i in l:
	if i == tom:
		print(l.index(i) + 1)
		break


def f(x):
	return x[1]
n = int(input())
d = []
for i in range(n):
	arr = list(map(int, input().split()))
	s = sum(arr)
	d.append((i + 1, s))
d.sort(key=f, reverse=True)
for i in range(n):
	if d[i][0] == 1:
		print(i + 1)


array = []
for i in range(int(input())):
	x = [int(i) for i in input().split()]
	jlh = 0
	for j in range(len(x)):
		jlh += x[j]
	array += [jlh]
thom = array[0]
for i in range(len(array) - 1):
	for j in range(i + 1, len(array)):
		if array[i] <= array[j]:
			(array[i], array[j]) = (array[j], array[i])
for i in range(len(array)):
	if array[i] == thom:
		print(i + 1)
		break


n = int(input())
k = []
z = []
for i in range(0, n):
	a = list(map(int, input().split()))
	k.append(sum(a))
z = k
b = z[0]
k.sort()
k = k[::-1]
for j in range(0, len(k)):
	if b == k[j]:
		print(j + 1)
		break


n = int(input())
a = []
for i in range(n):
	a.append((sum(map(int, input().split())), i))
a = sorted(a, reverse=True)
j = None
for i in range(len(a)):
	if a[i][1] == 0:
		j = i
		while j >= 0 and a[j][0] == a[i][0]:
			j -= 1
		break
print(j + 2)


I = lambda : map(int, input().split())
d = {}
n = int(input())
for i in range(n):
	d[i + 1] = sum(list(I()))
l = list(d.values())
l.sort(reverse=True)
print(l.index(d[1]) + 1)


n = int(input())
score = []
for i in range(n):
	a = [int(x) for x in input().split()]
	summ = sum(a)
	if i == 0:
		th = summ
	score.append((i, summ))
score = sorted(score, key=lambda x: (-x[1], x[0]))
print(score.index((0, th)) + 1)


t = int(input())
m = t
sum = []
while t:
	(a, b, c, d) = list(map(int, input().split()))
	sum.append(a + b + c + d)
	t = t - 1
b = 0
for i in range(m):
	if sum[i] > sum[0]:
		b = b + 1
print(b + 1)


n = int(input())
(e, g, m, h) = map(int, input().split())
sum = e + g + m + h
rank = 1
for _ in range(2, n + 1):
	(e, g, m, h) = map(int, input().split())
	if sum < e + g + m + h:
		rank += 1
print(rank)


n = int(input())
li = []
for i in range(n):
	a = list(map(int, input().split()))
	li.append(a)
tot = []
for i in range(n):
	totmark = 0
	for j in range(4):
		totmark += li[i][j]
	tot.append(totmark)
flag = tot[0]
tot.sort(reverse=True)
df = tot.index(flag)
print(df + 1)


from sys import stdin, stdout
n = int(stdin.readline().rstrip())
a = []
b = []
c = []
d = []
sum = {}
for i in range(n):
	nums = [int(x) for x in stdin.readline().rstrip().split()]
	a.append(nums[0])
	b.append(nums[1])
	c.append(nums[2])
	d.append(nums[3])
	sum[i] = a[i] + b[i] + c[i] + d[i]
c = 0
for (key, value) in sorted(sum.items(), key=lambda x: x[1], reverse=True):
	c += 1
	if sum[0] == value:
		stdout.write(str(c))
		break


n = int(input())
scores = [sum((int(x) for x in input().split())) for i in range(n)]
idx = sorted(range(n), key=lambda i: scores[i], reverse=True)
print(idx.index(0) + 1)


n = int(input())
totals = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	k = a + b + c + d
	totals.append(k)
rank = 1
for i in range(1, n):
	if totals[i] > totals[0]:
		rank = rank + 1
print(rank)


n = int(input())
a = []
for i in range(n):
	if i == 0:
		q = sum(list(map(int, input().split())))
		a.append(q)
	else:
		a.append(sum(list(map(int, input().split()))))
b = a.copy()
a.sort(key=lambda x: [x, -b.index(x)], reverse=True)
print(a.index(q) + 1)


from functools import reduce
total = int(input())
thomas = sum(tuple(map(int, input().split())))
higher = reduce(lambda r, c: r + 1 if sum(tuple(map(int, input().split()))) > thomas else r, range(total - 1), 0)
print(higher + 1)


def solution():
	n = int(input())
	target = sum(map(int, input().split()))
	print(1 + sum((1 if sum(map(int, input().split())) > target else 0 for _ in range(n - 1))))
solution()


n = int(input())
v = []
for i in range(n):
	l = list(map(int, input().split()))
	s = sum(l)
	v.append(s)
ma = v[0]
rank = 1
for i in range(1, len(v)):
	if v[i] > ma:
		rank += 1
print(rank)


x = int(input())
m = [int(_) for _ in input().split()]
for _ in range(x - 1):
	k = [int(_) for _ in input().split()]
	if sum(k) <= sum(m):
		x -= 1
print(x)


n = int(input())
x = [int(x) for x in input().split()]
mx = sum(x)
count = 1
for i in range(n - 1):
	x = [int(x) for x in input().split()]
	if sum(x) > mx:
		count = count + 1
print(count)


stud_numbers = int(input())
thom_smith_score = sum([int(i) for i in input().split()])
rank = 1
for i in range(1, stud_numbers):
	if thom_smith_score < sum([int(i) for i in input().split()]):
		rank += 1
print(rank)


place = 1
n = int(input())
n -= 1
(a, b, c, d) = map(int, input().split())
ssum = a + b + c + d
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	sum = a + b + c + d
	if ssum < sum:
		place += 1
print(place)


n = int(input())
li = []
for a in range(n):
	(a, b, c, d) = map(int, input().split())
	sum = a + b + c + d
	li.append(sum)
count = 0
for a in range(1, len(li)):
	if li[a] <= li[0]:
		count += 1
print(n - count)


t = int(input())
count = 1
ans = sum(list(map(int, input().split())))
for j in range(1, t):
	l = sum(list(map(int, input().split())))
	if l > ans:
		count += 1
print(count)


q = []
for i in range(int(input())):
	q.append(sum([int(x) for x in input().split()]))
print(sorted(q, reverse=True).index(q[0]) + 1)


n = int(input())
d = {}
for i in range(n):
	s = sum(list(map(int, input().split())))
	if i + 1 == 1:
		rank = 1
	elif s > d[1]:
		rank += 1
	d[i + 1] = s
print(rank)


n = int(input())
lst = []
for i in range(n):
	a = list(map(int, input().split()))
	lst.append(a)
a = sum(lst[0])
cnt = 1
for i in range(1, len(lst)):
	if a < sum(lst[i]):
		cnt = cnt + 1
print(cnt)


n = int(input())
data = []
for idx in range(n):
	(a, b, c, d) = map(int, input().split(' '))
	data.append((a + b + c + d, n - idx, idx + 1))
data.sort(reverse=True)
for (i, d) in enumerate(data):
	if d[2] == 1:
		print(i + 1)
		break
pass


def input1():
	raw = input()
	mp = map(int, raw.split())
	f_res = sum(mp)
	return f_res
n = int(input())
his = input1()
res = 1
cnt = 1
while cnt < n:
	if input1() > his:
		res += 1
	cnt += 1
print(res)


d = {}
for _ in range(int(input())):
	l = sum(list(map(int, input().split())))
	d[_ + 1] = l
d = sorted(d.items(), key=lambda k: (k[1], k[1]), reverse=True)
count = 1
for (a, b) in d:
	if a == 1:
		break
	else:
		count += 1
print(count)


def merge(a, low, high):
	mid = int((low + high) / 2)
	i = low
	j = mid + 1
	temp = []
	while i <= mid and j <= high:
		if a[i] < a[j]:
			temp.append(a[i])
			i += 1
		else:
			temp.append(a[j])
			j += 1
	while i <= mid:
		temp.append(a[i])
		i += 1
	while j <= high:
		temp.append(a[j])
		j += 1
	a[low:high + 1] = temp

def ms(l, low, high):
	if low == high:
		return
	mid = int((low + high) / 2)
	ms(l, low, mid)
	ms(l, mid + 1, high)
	merge(l, low, high)
n = int(input())
s = []
for i in range(n):
	l = [int(x) for x in input().split()]
	s.append(sum(l))
roj = s[0]
ms(s, 0, n - 1)
s = s[-1::-1]
print(s.index(roj) + 1)


n = int(input())
sum_r = 0
r = []
for i in range(0, n):
	b = sum(map(int, input().split()))
	r.append(b)
c = r[0]
r.sort()
r.reverse()
for i in range(len(r)):
	if c == r[i]:
		w = i
		break
print(w + 1)


n = int(input())
lst1 = [sum(map(int, input().split())) for _ in range(n)]
lst2 = [x for x in lst1 if x > lst1[0]]
print(len(lst2) + 1)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, **kwargs, file=sys.stderr)
	dprint('debug mode')
except ModuleNotFoundError:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N,) = getIntList()
zz = []
for i in range(N):
	zx = getIntList()
	zz.append((sum(zx), -i, i + 1))
zz.sort(reverse=True)
for i in range(N):
	if zz[i][2] == 1:
		print(i + 1)
		break


n = int(input())
sum_aim = sum(map(int, input().split()))
lis = [sum_aim]
for i in range(n - 1):
	sum_ = sum(map(int, input().split()))
	lis.append(sum_)
lis.sort(reverse=True)
rank = 1
for v in lis:
	if v == sum_aim:
		print(rank)
		exit()
	else:
		rank += 1


no = int(input())
rank = 1
for i in range(no):
	(a, b, c, d) = map(int, input().split())
	marks = a + b + c + d
	if i == 0:
		tom = marks
		continue
	elif marks > tom:
		rank += 1
print(rank)


id = int(input())
thomas = sum(map(int, input().split()))
l = [(1, thomas)]
for i in range(1, id):
	(a, b, c, d) = map(int, input().split())
	p = sum([a, b, c, d])
	l.append((i + 1, p))
l.sort(key=lambda x: x[1], reverse=True)
for i in range(len(l)):
	if l[i][0] == 1:
		print(i + 1)
		break


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


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [[0, 1], [0, -1], [1, 0], [1, -1]]
NEIGHBOURS = [(i, j) for i in range(-1, 2) for j in range(-1, 2) if i != 0 or j != 0]
OrdUnicode_a = ord('a')
OrdUnicode_A = ord('A')
CAPS_ALPHABETS = {chr(i + OrdUnicode_A): i for i in range(26)}
SMOL_ALPHABETS = {chr(i + OrdUnicode_a): i for i in range(26)}
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0) + 1
INFINITY = float('inf')
N = int(input())
d = {}
for i in range(1, N + 1):
	d[i] = sum(get_list())
rank = 1
for (k, v) in sorted(d.items(), key=lambda x: (-x[1], x[0])):
	if k == 1:
		break
	rank += 1
print(rank)


n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
tom = sum(info[0])
ans = 1
for i in range(1, n):
	if tom < sum(info[i]):
		ans += 1
print(ans)


n = int(input())
l = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	k = a + b + c + d
	l.append(k)
ma = l[0]
l.sort()
l = l[::-1]
for i in range(len(l)):
	if l[i] == ma:
		print(i + 1)
		break


import math
import itertools
getInputList = lambda : list(input().split())
getInputIntList = lambda : list(map(int, input().split()))
n = int(input())
a = []
a.append(sum(getInputIntList()))
b = a[0]
for i in range(n - 1):
	a.append(sum(getInputIntList()))
a.sort(reverse=True)
c = 1
for i in a:
	if i == b:
		print(c)
		break
	c += 1


n = int(input())
ans = 1
thomas = 0
for i in range(n):
	score = sum([*map(int, input().split())])
	if i == 0:
		thomas = score
	if score > thomas:
		ans += 1
print(ans)


l = []
n = int(input())
for _ in range(n):
	(a, b, c, d) = [int(x) for x in input().split()]
	l.append(a + b + c + d)
x = 1
for i in range(1, n):
	if l[i] > l[0]:
		x += 1
print(x)


a = sorted(((400 - sum(map(int, input().split())), i) for i in range(int(input()))))
for i in range(len(a)):
	if a[i][1] == 0:
		print(i + 1)


x = int(input())
s = []
for i in range(x):
	l = list(map(int, input().split()))
	if i == 0:
		smith = sum(l)
	s.append(sum(l))
s.sort(reverse=True)
if smith in s:
	print(s.index(smith) + 1)


n = int(input())
l = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	l.append(a + b + c + d)
x = l[0]
l.sort()
l = l[::-1]
i = l.index(x)
print(i + 1)


n = int(input())
a = []
for i in range(n):
	aa = input().split()
	aa = [int(item) for item in aa]
	a.append(aa)
s = []
for i in range(n):
	s.append(sum(a[i]))
t = s[0]
s.sort()
s.reverse()
ans = s.index(t) + 1
print(ans)


a = int(input())
l = list(map(int, input().split()))
k = 1
for i in range(a - 1):
	l2 = list(map(int, input().split()))
	if sum(l2) > sum(l):
		k += 1
print(k)


a = int(input())
r = list(map(int, input().split()))
q = sum(r)
lis = []
lis.append(q)
for x in range(a - 1):
	b = list(map(int, input().split()))
	c = sum(b)
	lis.append(c)
lis.sort(reverse=True)
print(lis.index(q) + 1)


n = int(input())
tem = []
for _ in range(n):
	a = list(map(int, input().split()))
	tem.append(sum(a))
x = tem[0]
tem.sort()
tem.reverse()
for i in range(n):
	if tem[i] == x:
		y = i
		break
print(y + 1)


n = int(input())
grades = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	grades.append([i + 1, a, b, c, d])
grades = sorted(grades, key=lambda item: [item[1] + item[2] + item[3] + item[4], -item[0]])
for i in range(n):
	if grades[i][0] == 1:
		print(n - i)
		break


n = int(input())
flag = 0
cnt = 1
for i in range(n):
	x = list(map(int, input().split()))
	if flag == 0:
		thomas = sum(x)
		flag = 1
	if sum(x) > thomas:
		cnt += 1
print(cnt)


p = []
for x in range(0, int(input())):
	l = list(map(int, input().strip().split()[:4]))
	if x == 0:
		n = sum(l)
	p.append(sum(l))
p.sort()
p.reverse()
print(p.index(n) + 1)


n = int(input())
table = dict()
for i in range(n):
	mark_sum = sum(map(int, input().split(' ')))
	if not i:
		thomas_mark = mark_sum
	table[mark_sum] = table[mark_sum] + 1 if mark_sum in table else 1
table = list(table.items())
result = sum([el[1] for el in table if el[0] > thomas_mark])
print(result + 1)


n = int(input())
m = []
p = []
u = 0
for _ in range(n):
	l = list(map(int, input().split()))
	m.append(l)
for l in m:
	x = sum(l)
	p.append(x)
a = p[0]
p = sorted(p)
p = p[::-1]
x = p.index(a)
print(x + 1)


x = input().split()
dt = dict()
for i in range(int(x[0])):
	dt[i] = input().split()
	h = 0
	for j in range(4):
		dt[i][j] = int(dt[i][j]) - 100
		h += int(dt[i][j]) - 100
	dt[i] = h
dict = sorted(dt.items(), key=lambda d: d[1], reverse=True)
for i in range(len(dict)):
	if dict[i][0] == 0:
		print(i + 1)
		break


n = int(input())
count = 0
results = []
for i in range(1, n + 1):
	if i == 1:
		r = sum(tuple(map(int, input().split())))
	elif sum(tuple(map(int, input().split()))) <= r:
		count += 1
print(n - count)


n = int(input())
a = []
s = sum(list(map(int, input().split())))
ans = 1
for i in range(n - 1):
	x = sum(list(map(int, input().split())))
	if x > s:
		ans += 1
print(ans)


a = int(input())
b = []
l = []
k = []
m = []
for x in range(a):
	b.append(list(map(int, input().split())))
	l.append(sum(b[x]))
	k.append(sum(b[x]))
k.sort(reverse=True)
for x in range(a):
	if k[x] == l[0]:
		m.append(x)
print(min(m) + 1)


def ni(a, j=0, k=''):
	for i in range(len(a)):
		if a[i] == ' ':
			j += int(k)
			k = ''
		else:
			k = k + a[i]
	return j

def sort(A, B, h=1):
	for i in range(len(A) - 1, -1, -1):
		for j in range(i):
			if A[i] < A[j]:
				(A[i], A[j]) = (A[j], A[i])
				(B[i], B[j]) = (B[j], B[i])
			if A[i] == A[j] and B[i] > B[j]:
				(A[i], A[j]) = (A[j], A[i])
				(B[i], B[j]) = (B[j], B[i])
	for i in range(len(A)):
		if B[i] == 1:
			return h
		h += 1
n = int(input())
l = n * [0]
k = l[:]
for i in range(n):
	l[i] = input()
	l[i] = ni(l[i] + ' ')
	k[i] = i + 1
print(n - sort(l, k) + 1)


n = int(input())
L = []
for i in range(n):
	L.append(sum([int(x) for x in input().split()]))
S = L[0]
L.sort(reverse=True)
print(L.index(S) + 1)


n = int(input())
rank = 1
a = []
for i in range(n):
	(x, y, z, w) = map(int, input().split())
	sum = x + y + z + w
	a.append(sum)
max = a[0]
for i in range(n):
	if a[i] > max:
		rank = rank + 1
print(rank)


n = int(input())
a = []
c = []
for i in range(n):
	b = [int(x) for x in input().split()]
	a.append(sum(b))
	c.append(sum(b))
c.sort()
for i in range(n - 1, -1, -1):
	if a[0] == c[i]:
		print(n - i)
		break


n = int(input())
lt = []
s = 0
c = 0
while n:
	l = list(map(int, input().split()))
	n = n - 1
	for i in l:
		s = s + i
	lt.append(s)
	s = 0
st = lt[0]
lt.sort(reverse=True)
for i in lt:
	c = c + 1
	if st == i:
		break
print(c)


def answer():
	a = int(input())
	i = 1
	c = []
	d = []
	while a:
		b = sum([int(x) for x in input().split()])
		c.append([b, -i])
		i += 1
		a -= 1
	c.sort()
	c.reverse()
	i = 0
	ans = 0
	while i < len(c):
		if c[i][1] == -1:
			ans = i
			break
		i += 1
	return ans + 1
print(answer())


n = int(input())
tot = 0
mx = sum(map(int, input().split()))
ans = 1
for i in range(n - 1):
	tot = sum(map(int, input().split()))
	if mx < tot:
		ans = ans + 1
print(ans)


n = int(input())
totalMarks = []
for i in range(n):
	(eng, ger, mat, his) = map(int, input().split())
	totalMarks.append(eng + ger + mat + his)
thomas = totalMarks[0]
rank = 1
totalMarks.sort(reverse=True)
for i in totalMarks:
	if i == thomas:
		print(rank)
		break
	else:
		rank += 1


N = int(input())
hash_map = {}
i = 1
while i <= N:
	arr = input().split()
	arr = [int(c) for c in arr]
	hash_map[i] = sum(arr)
	i += 1
hash_map = {k: v for (k, v) in sorted(hash_map.items(), key=lambda x: x[1], reverse=True)}
keys = list(hash_map.keys())
print(keys.index(1) + 1)


def main():
	n = int(input())
	i = 1
	result = []
	while i <= n:
		marks = list(map(int, input().split()))
		sum_ = sum(marks)
		if i == 1:
			thomas = sum_
		result.append(sum_)
		i += 1
	result.sort(reverse=True)
	print(result.index(thomas) + 1)
main()


try:
	while True:
		ss = []
		n = int(input())
		for i in range(n):
			scores = list(map(int, input().split()))
			ss.append(sum(scores))
		target = ss[0]
		ss.sort(reverse=True)
		ans = ss.index(target) + 1
		print(ans)
except Exception as e:
	pass


n = int(input())
L = []
for k in range(n):
	(a, b, c, d) = map(int, input().split())
	L.append((a + b + c + d, n - k))
L = sorted(L)
L1 = [k[1] for k in L]
print(n - L1.index(n))


n = int(input())
k = 1
l = sum(map(int, input().split()))
for i in range(2, n + 1):
	if sum(map(int, input().split())) > l:
		k += 1
print(k)


n = int(input())
(a, b, c, d) = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
tm = a + b + c + d
rank = 1
for i in range(n - 1):
	(a, b, c, d) = input().split()
	a = int(a)
	b = int(b)
	c = int(c)
	d = int(d)
	sum = a + b + c + d
	if sum > tm:
		rank = rank + 1
print(rank)


x = int(input())
z = []
a = {}
b = []
c = 1
for i in range(1, x + 1):
	y = [int(a) for a in input().split()]
	z.append(sum(y))
k = z.copy()
z.sort(reverse=True)
for i in z:
	if i not in a:
		a[i] = c
		c += 1
	else:
		c += 1
print(a[k[0]])


n = int(input())
s = {}
for i in range(n):
	s[i] = sum(map(int, input().split()))
ss = sorted(s.items(), key=lambda x: (x[1], n - x[0]), reverse=True)
cnt = 1
for i in ss:
	if i[0] == 0:
		print(cnt)
		break
	else:
		cnt += 1


n = int(input())
sums = []
x = []
for i in range(n):
	(g, m, e, h) = input().split()
	g = int(g)
	e = int(e)
	m = int(m)
	h = int(h)
	sums.append(g + e + m + h)
	x.append(g + e + m + h)
sums.sort(reverse=True)
for i in sums:
	if i == x[0]:
		y = sums.index(i) + 1
print(y)


n = int(input())
nilai = []
for i in range(n):
	a = [int(i) for i in input().split()]
	tot = 0
	for i in a:
		tot += i
	nilai += [tot]
thom = nilai[0]
for i in range(len(nilai)):
	for j in range(i + 1, len(nilai)):
		if nilai[i] <= nilai[j]:
			(nilai[i], nilai[j]) = (nilai[j], nilai[i])
for i in range(len(nilai)):
	if thom == nilai[i]:
		print(i + 1)
		break


n = int(input())
num = []
for i in range(n):
	num.append([int(i) for i in input().split()])
id1 = sum(num[0])
count = 1
for v in num:
	if sum(v) > id1:
		count += 1
print(count)


n = int(input())
L = []
flag = True
for i in range(n):
	s = sum(map(int, input().split()))
	if flag:
		tom = s
		flag = False
	L.append(s)
L.sort(reverse=True)
i = L.index(tom)
print(i + 1)


noStudents = int(input())
examScores = []
rank = 1
for _ in range(noStudents):
	(a, b, c, d) = map(int, input().split())
	personalScores = [a, b, c, d]
	examScores.append(personalScores)
thomasScore = examScores[0][0] + examScores[0][1] + examScores[0][2] + examScores[0][3]
for i in range(1, len(examScores)):
	guyScore = examScores[i][0] + examScores[i][1] + examScores[i][2] + examScores[i][3]
	if guyScore > thomasScore:
		rank += 1
print(rank)


n = int(input())
marks = []
(a, b, c, d) = map(int, input().split(' '))
thomasMarks = a + b + c + d
marks.append(thomasMarks)
for i in range(1, n):
	(a, b, c, d) = map(int, input().split(' '))
	marks.append(a + b + c + d)
marks.sort(reverse=True)
print(marks.index(thomasMarks) + 1)


def rank(m):
	mx = -1
	rnk = -1
	tms = sum(m[0])
	tbl = []
	for i in range(len(m)):
		tbl.append(sum(m[i]))
	tbl.sort()
	tbl = tbl[::-1]
	for i in range(len(tbl)):
		if tbl[i] == tms:
			return i + 1
n = int(input())
m = []
for _ in range(n):
	m.append(list(map(int, input().split())))
print(rank(m))


n = input()
s = []
for i in range(int(n)):
	s.append([int(x) for x in input().split()])
ssum = []
for el in s:
	ssum.append(sum(el))
count = 1
for el in ssum[1:]:
	if el > ssum[0]:
		count += 1
print(count)


(n, res) = (int(input()), [])
for i in range(n):
	res.append(sum([int(i) for i in input().split()]))
p = [(index + 1, value) for (index, value) in enumerate(res)]
q = sorted(p, key=lambda x: x[1], reverse=True)
for m in q:
	if m[0] == 1:
		print(q.index(m) + 1)


a = int(input())
l = list(map(int, input().split()))
p = 0
t = 0
k = 1
for i in range(a - 1):
	l1 = list(map(int, input().split()))
	if sum(l1) > sum(l):
		k += 1
print(k)


n = int(input())
k = []
l = []
g = 0
for i in range(n):
	a = [int(x) for x in input().split()]
	k.append(sum(a))
g = k[0]
k.sort()
k.reverse()
print(k.index(g) + 1)


n = int(input())
sum_array = []
thomas_score = 0
for i in range(n):
	temp = list(map(int, input().split(' ')))
	sum = 0
	for v in temp:
		sum = sum + v
	sum_array.append(sum)
	if i == 0:
		thomas_score = sum
sum_array.sort(reverse=True)
for i in range(len(sum_array)):
	if thomas_score == sum_array[i]:
		print(i + 1)
		break


n = int(input())
scores = []
add = []
for i in range(0, n):
	scores = scores + [int(scores) for scores in input().split()]
	add = add + [sum(scores)]
	del scores[0:]
thomas = add[0]
add = sorted(add, reverse=True)
for i in range(0, n):
	if thomas == add[i]:
		scores = scores + [i]
print(min(scores) + 1)


n = int(input())
a = []
for i in range(n):
	(q, w, e, r) = map(int, input().split())
	q += w + e + r
	a.append([-q, i])
a.sort()
for i in range(n):
	if a[i][1] == 0:
		print(i + 1)
		exit(0)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
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 I():
	return int(sys.stdin.readline())

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

def S():
	return input()

def main():
	n = I()
	l = []
	for i in range(n):
		(a, b, c, d) = LI()
		l.append([i, sum([a, b, c, d])])
	l = sorted(l, key=lambda x: x[0])
	l = sorted(l, key=lambda x: x[1], reverse=True)
	for (i, x) in enumerate(l):
		if x[0] == 0:
			return i + 1
print(main())


n = int(input())
t = input().split()
t = list(map(int, t))
s = 0
for i in range(4):
	s += t[i]
place = 1
for j in range(1, n):
	b = input().split()
	b = list(map(int, b))
	cd = 0
	for i in range(4):
		cd += b[i]
	if cd > s:
		place += 1
print(place)


n = int(input())
string = str(input())
S = sum(map(int, string.split(' ')))
ans = 1
for _ in range(2, n + 1):
	string = str(input())
	if sum(map(int, string.split(' '))) > S:
		ans += 1
print(ans)


ans = []
for i in range(1, int(input()) + 1):
	l = list(map(int, input().split()))
	ans.append(sum(l))
index = 1
max = ans[0]
for i in range(1, len(ans)):
	if ans[i] > max:
		index += 1
print(str(index))


import operator

def sort_list_by_multiple_attributes(y):
	return sorted(y, key=operator.itemgetter(1, 1), reverse=True)
M = lambda : list(map(int, input().split()))
n = int(input())
s = []
for i in range(0, n):
	s.append(sum(M()))
d = sort_list_by_multiple_attributes(list(zip(list(range(1, n + 1)), s)))
print([d.index(item) for item in d if item[0] == 1][0] + 1)


n = int(input())
l = []
while n:
	(a, b, c, d) = map(int, input().split())
	l.append(a + b + c + d)
	n = n - 1
m = l[0]
l.sort()
l1 = l[::-1]
l2 = []
for i in range(len(l1)):
	if m == l1[i]:
		l2.append(l[0])
print(l1.index(m) + 1)


n = int(input())
a = list(map(int, input().split()))
a = sum(a)
place = 1
for i in range(n - 1):
	f = list(map(int, input().split()))
	f = sum(f)
	if f > a:
		place += 1
print(place)


n = int(input())
A = []
place = 1
mark = sum(map(int, input().split()))
for i in range(n - 1):
	A.append(sum(map(int, input().split())))
for elem in A:
	if elem > mark:
		place += 1
print(place)


y = int(input())
l = []
s = []
for i in range(y):
	x = list(map(int, input().split()))
	l.append(x)
for i in range(y):
	count = 0
	for j in range(4):
		count = count + l[i][j]
	s.append(count)
plus = 0
for i in range(len(s)):
	if s[i] > s[0]:
		plus += 1
print(plus + 1)


from math import sqrt

def main():
	n = int(input())
	res = []
	for i in range(n):
		s = sum([int(v) for v in input().split()])
		res.append((i + 1, s))
	res = sorted(res, key=lambda b: (b[1], -1 * b[0]), reverse=True)
	for i in range(n):
		if res[i][0] == 1:
			print(i + 1)
main()


gi = lambda : list(map(int, input().split()))
(n,) = gi()
scores = [(sum(gi()), -k) for k in range(1, n + 1)]
scores.sort(reverse=True)
for k in range(n):
	if scores[k][1] == -1:
		print(k + 1)
		exit()


n = int(input())
t = sum(map(int, input().split()))
place = 1
for i in range(n - 1):
	s = sum(map(int, input().split()))
	if t < s:
		place += 1
print(place)


n = int(input())
score = []
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	score.append(a + b + c + d)
req = score[0]
score.sort(reverse=True)
rank = score.index(req) + 1
print(rank)


n = int(input())
(a, *b) = (sum(map(int, input().split())) for i in range(n))
print(sum((s > a for s in b)) + 1)


class Student:

	def __init__(self, id, g1, g2, g3, g4):
		self.id = id
		self.grade = int(g1) + int(g2) + int(g3) + int(g4)
students = []
num_students = int(input())
for id in range(num_students):
	g = input().split()
	students.append(Student(id, int(g[0]), int(g[1]), int(g[2]), int(g[3])))
students.sort(key=lambda x: x.grade, reverse=True)
for x in range(num_students):
	if students[x].id == 0:
		print(x + 1)


n = int(input())
thomas = sum(map(int, input().split()))
all = [thomas]
for _ in range(n - 1):
	all.append(sum(map(int, input().split())))
all.sort(reverse=True)
i = all.index(thomas)
print(i + 1)


import queue
import sys
input = sys.stdin.readline

def main():
	N = int(input())
	sum_list = []
	for i in range(N):
		res = list(map(int, input().split()))
		sum_list.append((sum(res), -(i + 1)))
	sum_list.sort(reverse=True)
	for i in range(N):
		if -sum_list[i][1] == 1:
			print(i + 1)
			break
	return
main()


n = int(input())
a = sum(map(int, input().split()))
ans = 1
for i in range(n - 1):
	b = sum(map(int, input().split()))
	if b > a:
		ans += 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
l = sum(a)
r = 1
for i in range(n - 1):
	a = list(map(int, input().split()))
	if sum(a) > l:
		r = r + 1
print(r)


n = int(input())
c = [int(x) for x in input().split()]
h = sum(c)
s = 1
for i in range(n - 1):
	c = [int(x) for x in input().split()]
	if sum(c) > h:
		s = s + 1
print(s)


n = int(input())
l = []
while n != 0:
	n -= 1
	l.append(sum([int(i) for i in input().split()]))
l1 = sorted(l)
l1.reverse()
print(l1.index(l[0]) + 1)


n = int(input())
marks = []
reqM = []
for i in range(0, n):
	x = list(map(int, input().split()))
	marks.append(x)
a = sum(marks[0])
for i in range(0, n):
	reqM.append(sum(marks[i]))
reqM.sort()
reqM.reverse()
q = reqM.index(a) + 1
print(q)


from operator import itemgetter
n = int(input())
o = []
table = []
for i in range(n):
	table.append((sum(list(map(int, input().split()))), i + 1))
id_sorted = sorted(table, key=itemgetter(1))
test_sorted = sorted(id_sorted, key=itemgetter(0), reverse=True)
for (i, tupl) in enumerate(test_sorted):
	if tupl[1] == 1:
		print(i + 1)
		break


n = int(input())
(a, b, c, d) = map(int, input().split())
sum = a + b + c + d
r = 1
for i in range(2, n + 1):
	(a, b, c, d) = map(int, input().split())
	if a + b + c + d > sum:
		r = r + 1
print(r)


n = int(input())
lst = []
while n:
	n -= 1
	(a, b, c, d) = [int(i) for i in input().split()]
	lst.append(a + b + c + d)
lst2 = sorted(lst)
lst2.reverse()
print(lst2.index(lst[0]) + 1)


n = int(input())
e = True
f = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	if e:
		mx = a + b + c + d
		e = False
	f.append(a + b + c + d)
f.sort(reverse=True)
print(f.index(mx) + 1)


n = int(input())
son = 0
rank = 0
s = 100000
for i in range(n):
	a = list(map(int, input().split()))
	if i == 0:
		son = sum(a)
	else:
		s = sum(a)
	if s > son:
		rank += 1
print(rank)


n = int(input())
arr = list(map(int, input().split()))
tot = sum(arr)
cnt = 1
for i in range(n - 1):
	arr = list(map(int, input().split()))
	if sum(arr) > tot:
		cnt = cnt + 1
print(cnt)


n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
sums = list(zip(range(1, n + 1), map(sum, a)))
tom = sums[0]
sums.sort(key=lambda x: x[0])
sums.sort(key=lambda x: -x[1])
print(sums.index(tom) + 1)


no = int(input())
n = no
data = []
while no > 0:
	temp = input().split()
	data.append(temp)
	no = no - 1
rank = 0
score = []
compare = []
for i in data:
	i = list(map(int, i))
	score.append(sum(i))
if n > 1:
	compare = sorted(score[1:], reverse=True)
	for (i, j) in enumerate(compare):
		if score[0] >= j:
			rank = i
			break
		else:
			rank = rank + 1
else:
	rank = 0
print(rank + 1)


n = int(input())
arr = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	arr.append([i + 1, a + b + c + d])
arr = sorted(arr, key=lambda x: x[1], reverse=True)
for i in range(n):
	if arr[i][0] == 1:
		print(i + 1)


n = int(input())
d = {}
for i in range(n):
	r = list(map(int, input().split()))
	e = sum(r)
	d[e] = d.get(e, []) + [i + 1]
l = list(d.keys())
l.sort(reverse=True)
m = 0
for i in l:
	for j in d[i]:
		m += 1
		if j == 1:
			exit(print(m))


n = int(input())
arr = []
brr = []
crr = []
for i in range(n):
	(a, b, c, d) = [int(i) for i in input().split()]
	arr.append(a + b + c + d)
	brr.append(a + b + c + d)
brr.sort()
brr.reverse()
for i in range(n):
	if arr[0] == brr[i]:
		crr.append(i + 1)
print(min(crr))


n = int(input())
l = [None for i in range(n)]
for i in range(n):
	l[i] = sum([int(j) for j in input().split()])
k = l[0]
l = sorted(l)
print(l[::-1].index(k) + 1)


n = int(input())
result = []
for i in range(n):
	result.append(sum((int(i) for i in input().split())))
i = 1
rank = 1
for i in range(n):
	if result[i] > result[0]:
		rank += 1
print(rank)


from sys import stdin
from functools import reduce, cmp_to_key

def comp(a, b):
	if a[0] > b[0]:
		return -1
	elif a[0] == b[0]:
		if a[1] <= b[1]:
			return -1
		else:
			return 1
	else:
		return 1

def main():
	n = int(stdin.readline())
	students_scores = []
	for i in range(n):
		scores = [int(x) for x in stdin.readline().strip().split(' ')]
		total_score = reduce(lambda x, y: x + y, scores)
		students_scores.append((total_score, i))
	students_scores.sort(key=cmp_to_key(comp))
	for i in range(n):
		if students_scores[i][1] == 0:
			print(i + 1)
main()


n = int(input())
s = []
ts = 0
for i in range(n):
	g = [int(i) for i in input().split()]
	if i == 0:
		ts = g[0] + g[1] + g[2] + g[3]
	s.append(g[0] + g[1] + g[2] + g[3])
s.sort()
s.reverse()
for i in range(n):
	if s[i] == ts:
		print(i + 1)
		break


x = []
y = 0
z = -1
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	s = a + b + c + d
	if i == 0:
		y = s
	if s == y:
		z += 1
	x.append([s, i + 1])
x.sort(reverse=True)
print(x.index([y, 1]) + 1 - z)


n = int(input())
data = []
for i in range(n):
	data.append((sum(list(map(int, input().split()))), i + 1))
data.sort(key=lambda x: (-x[0], x[1]))
answer = 0
while True:
	answer += 1
	if data[answer - 1][1] == 1:
		break
print(answer)


scores = []
for i in range(int(input())):
	inp = input().split(' ')
	summed = 0
	for k in inp:
		summed += int(k)
	scores.append(summed)
pos = 1
for i in scores:
	if i > scores[0]:
		pos += 1
print(pos)


n = int(input())
point = 1
Thomas = list(map(int, input().split()))
for i in range(1, n):
	temp = list(map(int, input().split()))
	if temp[0] + temp[1] + temp[2] + temp[3] > Thomas[0] + Thomas[1] + Thomas[2] + Thomas[3]:
		point += 1
print(point)


n = int(input())
m = [(i, sum(map(int, input().split()))) for i in range(n)]
from operator import itemgetter
m.sort(key=itemgetter(1), reverse=True)
for (i, e) in enumerate(m):
	if e[0] == 0:
		print(i + 1)
		break


n = int(input())
total_score_board = []
i = 0
x = n
for i in range(n):
	xx = input().split()
	x1 = [int(yy) for yy in xx]
	total_score_board.append(sum(x1))
thomas_score = total_score_board[0]
sorted_score = sorted(total_score_board, reverse=True)
rank = sorted_score.index(thomas_score)
print(int(rank + 1))


n = int(input())
m = 0
k = 1
p = 0
r = 1
while m < n:
	s = list(map(int, input().split()))
	if k == 1:
		p = sum(s)
	elif sum(s) > p:
		r = r + 1
	k = k + 1
	m = m + 1
print(r)


n = int(input())
count = 1
s = sum(list(map(int, input().split())))
for _ in range(n - 1):
	if sum(list(map(int, input().split()))) > s:
		count += 1
print(count)


rank = 1
n = int(input())
pointsThomas = sum([int(x) for x in input().split(' ')])
for _ in range(n - 1):
	if pointsThomas < sum([int(x) for x in input().split(' ')]):
		rank += 1
print(rank)


a = int(input())
b = sum(list(map(int, input().split())))
c = 1
for i in range(a - 1):
	d = sum(list(map(int, input().split())))
	if d > b:
		c += 1
print(c)


n = int(input())
su = sum(list(map(int, input().split(' '))))
res = 1
for i in range(n - 1):
	su1 = sum(list(map(int, input().split(' '))))
	if su1 > su:
		res += 1
print(res)


ans = 1
n = int(input())
s = map(int, input().split())
s = sum(s)
for _ in range(n - 1):
	tmp = map(int, input().split())
	tmp = sum(tmp)
	if tmp > s:
		ans += 1
print(ans)


n = int(input())
x = []
p = []
q = []
for i in range(1, n + 1):
	l = list(map(int, input().split()))
	x.append(sum(l))
l = x[0]
q = sorted(x)
q = q[::-1]
for i in range(0, len(q)):
	if q[i] == l:
		print(i + 1)
		break


from sys import stdin
n = int(stdin.readline())
s = 0
q = []
for i in range(1, n + 1):
	(a, b, c, d) = map(int, input().split(' '))
	q.append(a + b + c + d)
r = 0
for i in range(0, len(q)):
	if q[0] < q[i]:
		r = r + 1
print(r + 1)


a = int(input())
x = []
for i in range(a):
	(e, b, c, d) = map(int, input().split())
	x.append(e + b + c + d)
cnt = 1
for i in range(1, a):
	if x[i] > x[0]:
		cnt += 1
print(cnt)


n = int(input())
B = []
for i in range(n):
	A = list(map(int, input().split()))
	B.append(sum(A))
c = B[0]
B = list(reversed(sorted(B)))
print(B.index(c) + 1)


c = []
for i in range(int(input())):
	a = input().split()
	a = int(a[0]) + int(a[1]) + int(a[2]) + int(a[3])
	if i == 0:
		b = a
	c.append(a)
c.sort()
c.reverse()
print(c.index(b) + 1)


n = int(input())
l = {}
for i in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	l.update({i + 1: (a + b + c + d) / 4})
mark = l[1]
l = sorted(l.values(), reverse=True)
print(l.index(mark) + 1)


def read():
	return int(input())

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

def readmap():
	return map(int, input().split())
n = read()
point = [(sum(readlist()), n - i) for i in range(n)]
point.sort(reverse=True)
for i in range(n):
	if point[i][1] == n:
		print(i + 1)
		quit()


students_number = int(input())
students_scores = list()
while students_number > 0:
	students_number = students_number - 1
	students_scores.append(input())

def calculate_sums(students_scores):
	students_sums = list()
	for student_scores in students_scores:
		scores = student_scores.split(' ')
		sum = 0
		for score in scores:
			sum = sum + int(score)
		students_sums.append(sum)
	return students_sums

def get_rank(students_sums):
	flag = 1
	for student_sum in students_sums:
		if student_sum > students_sums[0]:
			flag = flag + 1
	return flag
students_sums = calculate_sums(students_scores)
student_rank = get_rank(students_sums)
print(student_rank)


n = int(input())
q = []
s = sum(list(map(int, input().split())))
q.append(s)
for i in range(n - 1):
	q.append(sum(list(map(int, input().split()))))
q = sorted(q)[::-1]
for i in range(n):
	if s >= q[i]:
		break
print(i + 1)


n = int(input())
c = 0
son = sum(list(map(int, input().split()))) / 4
for i in range(n - 1):
	others = sum(list(map(int, input().split()))) / 4
	if son >= others:
		c += 1
print(n - c)


n = int(input())
a = [0] * n
for i in range(n):
	tmp = list(map(int, input().split(' ')))
	a[i] = sum(tmp)
t = a[0]
r = len(list(filter(lambda x: x > t, a))) + 1
print(r)


n = int(input())
k = 1
d = 0
for i in range(1, n + 1):
	a = list(map(int, input().split()))
	c = a[0] + a[1] + a[2] + a[3]
	if i == 1:
		d = a[0] + a[1] + a[2] + a[3]
	if d < c:
		k = k + 1
print(k)


import time
n = int(input())
t = sum((int(_) for _ in input().split()))
ans = 1
start = time.time()
for i in range(n - 1):
	(a, b, c, d) = (int(_) for _ in input().split())
	if a + b + c + d > t:
		ans += 1
print(ans)
finish = time.time()


n = int(input())
res = list()
for i in range(n):
	a = list(input().split(' '))
	a = list((int(x) for x in a))
	cur_sum = 0
	for item in a:
		cur_sum += item
	res.append((cur_sum, i + 1))
res = sorted(sorted(res, key=lambda x: x[1]), key=lambda x: x[0], reverse=True)
for i in range(n):
	if res[i][1] == 1:
		print(i + 1)
		break


a = int(input())
x = int(0)
m = []
while x < a:
	b = list(map(int, input().split()))
	m.append(sum(b))
	x = x + 1
c = m[0]
m = sorted(m, reverse=True)
print(m.index(c) + 1)


n = int(input())
tab = [sum(map(int, input().split())) for i in range(n)]
print(sum((x > tab[0] for x in tab[1:])) + 1)


p = 0
l = []
f = 0
for i in range(int(input())):
	p = sum(list(map(int, input().split())))
	if i == 0:
		l = l + [[p] + [1]]
		f = p
	else:
		l = l + [[p] + [0]]
l = sorted(l)
l.reverse()
print(l.index([f, 1]) + 1)


n = int(input())
scores = []
for i in range(n):
	score = sum([int(x) for x in input().split()])
	scores.append((score, i + 1))
scores = sorted(scores, key=lambda s: (s[0], -s[1]), reverse=True)
for (rank, s) in enumerate(scores):
	if s[1] == 1:
		print(rank + 1)
		break


(n, r) = (int(input()), 1)
s = sum([int(x) for x in input().split()])
for i in range(n - 1):
	r += 1 if sum([int(x) for x in input().split()]) > s else 0
print(r)


n = int(input())
s = []
r = []
for _ in range(n):
	(a, b, c, d) = map(int, input().split())
	s.append(a + b + c + d)
thomas = s[0]
m = max(s)
if m == thomas:
	print('1')
else:
	s.sort(reverse=True)
	print(s.index(thomas) + 1)


n = int(input())
l = [sum([int(x) for x in input().split()]) for i in range(n)]
res = 0
re = l[0]
for i in range(len(l)):
	if l[i] > re:
		res += 1
print(res + 1)


list1 = [sum(list(map(int, input().split()))) for i in range(int(input()))]
sum = list1[0]
list1.sort(reverse=True)
print(list1.index(sum) + 1)


def rank(arr):
	boi = arr[0]
	arr = sorted(arr, reverse=True)
	return arr.index(boi) + 1
n = int(input())
arr = []
for i in range(n):
	x = sum(list(map(int, input().rstrip().split())))
	arr.append(x)
print(rank(arr))


n = int(input())
a = []
c = sum(list(map(int, input().split())))
a.append(c)
for i in range(2, n + 1):
	b = list(map(int, input().split()))
	b = sum(b)
	a.append(b)
a.sort(reverse=True)
d = a.index(c)
print(d + 1)


ranks = list()
students = int(input())
for id in range(students):
	scores = map(int, input().split())
	ranks.append((sum(scores), -(id + 1)))
greater = [i for i in ranks if i > ranks[0]]
print(len(greater) + 1)


f = lambda : map(int, input().split())
n = int(input())
sc = []
while n:
	sc.append(sum((i for i in f())))
	n -= 1
m = sc[0]
sc.sort(reverse=True)
print(sc.index(m) + 1)


def Rank(s, x):
	total = []
	thomas = sum(s[0])
	for i in range(x):
		total.append(sum(s[i]))
	total.sort()
	total = total[::-1]
	return total.index(thomas) + 1
x = int(input())
s1 = []
for i in range(x):
	s = [int(n) for n in input().split()]
	s1.append(s)
print(Rank(s1, x))


import sys
n = int(input())
ar = []
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	ar.append((-(a + b + c + d), i))
ar = sorted(ar)
for (i, x) in enumerate(ar):
	if x[1] == 0:
		print(i + 1)


n = int(input())
sum1 = [0] * n
for i in range(n):
	marks = list(map(int, input().split()))
	for j in range(4):
		sum1[i] += marks[j]
ind = [i for i in range(n)]
rank = 1
for i in range(1, n):
	if sum1[0] < sum1[i]:
		rank += 1
print(rank)


n = int(input())
a = list((list(map(int, input().split())) for i in range(n)))
s = list((0 for i in range(n)))
c = 1
for j in range(n):
	for k in range(4):
		s[j] += a[j][k]
for i in range(1, n):
	if s[i] > s[0]:
		c += 1
print(c)


ans = 1
for t in range(int(input())):
	l = list(map(int, input().split()))
	if t == 0:
		s = sum(l)
	elif s < sum(l):
		ans += 1
print(ans)


base = 0
answer = 1
n = int(input())
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	tmp = a + b + c + d
	if i == 0:
		base = tmp
	elif tmp > base:
		answer += 1
print(answer)


(his_score, his_rank) = (None, 1)
for i in range(int(input())):
	this_score = sum([int(j) for j in input().split()])
	if his_score is None:
		his_score = this_score
	if this_score > his_score:
		his_rank += 1
print(his_rank)


n = int(input())
x = [int(j) for j in input().split()]
sum1 = 0
for j in x:
	sum1 += j
l = sum1
rank = 1
for i in range(n - 1):
	x = [int(j) for j in input().split()]
	sum1 = 0
	for j in x:
		sum1 += j
	if sum1 > l:
		rank += 1
print(rank)


number = int(input())
marks = [int(mark) for mark in input().split()]
marks = sum(marks)
score = marks
rank = 0
for i in range(number - 1):
	marks = [int(mark) for mark in input().split()]
	marks = sum(marks)
	if marks > score:
		rank += 1
print(rank + 1)


a = int(input())
t = []
for i in range(0, a):
	(b, c, d, e) = map(int, input().split())
	t.append(b + c + d + e)
x = 1
for j in range(1, len(t)):
	if t[j] > t[0]:
		x += 1
print(x)


import sys
import bisect
try:
	fin = open('in')
except:
	fin = sys.stdin
input = fin.readline
from math import gcd
n = int(input())
r = [(-sum(map(int, input().split())), i) for i in range(n)]
r.sort()
for i in range(n):
	if r[i][-1] == 0:
		print(i + 1)


n = int(input())
sum1 = []
for _ in range(n):
	lst = [int(x) for x in input().split()]
	sum1.append(sum(lst))
indexx = sum1[0]
sum1 = sorted(sum1, reverse=True)
print(sum1.index(indexx) + 1)


n = int(input())
tom = sum(map(int, input().split()))
ans = 1
for i in range(n - 1):
	if sum(map(int, input().split())) > tom:
		ans += 1
print(ans)


import math
n = int(input())
l = []
for i in range(n):
	ll = list(map(int, input().split()))
	l.append(ll)
p = []
for i in range(len(l)):
	s = sum(l[i])
	p.append(s)
m = p[0]
pp = sorted(p, reverse=True)
a = []
for i in range(len(pp)):
	if pp[i] == m:
		a.append(i + 1)
print(a[0])


x = int(input())
sums = []
n = 0
for i in range(x):
	numbers = list(map(int, input().split()))
	sums.append(sum(numbers))
	if i == 0:
		n = sum(numbers)
sums.sort()
sums.reverse()
print(sums.index(n) + 1)


def lol_kek():
	t = int(input())
	k2 = []
	for i in range(t):
		k = list(map(int, input().split()))
		k2.append(sum(k))
	k3 = k2.copy()
	k3.sort()
	k3 = k3[::-1]
	print(k3.index(k2[0]) + 1)
lol_kek()


from sys import stdin, stdout
i = map(int, stdin.readline().rstrip().split())
students = []
(a, b, c, d) = map(int, stdin.readline().rstrip().split())
tom_score = a + b + c + d
tom_place = 1
for _ in range(i.__next__() - 1):
	(a, b, c, d) = map(int, stdin.readline().rstrip().split())
	if a + b + c + d > tom_score:
		tom_place += 1
stdout.write(str(tom_place))


n = int(input())
x = list(map(int, input().split()))
s = sum(x)
rank = 1
for i in range(1, n):
	x = list(map(int, input().split()))
	s1 = sum(x)
	if s1 > s:
		rank += 1
print(rank)


n = int(input())
vals = [(-sum(map(int, input().split())), i + 1) for i in range(n)]
vals.sort()
for (idx, (_, stId)) in enumerate(vals):
	if stId == 1:
		print(idx + 1)
		break


a = int(input())
s = []
for i in range(a):
	c = sum([int(x) for x in input().split()])
	s.append((i + 1, c))
s.sort(key=lambda x: x[1], reverse=True)
for x in range(a):
	if s[x][0] == 1:
		print(x + 1)
		break


n = int(input())
r = map(int, input().split())
r = sum(r)
rr = 1
for k in range(n - 1):
	ar = map(int, input().split())
	aux = sum(ar)
	if r < aux:
		rr += 1
print(rr)


n = int(input())
sums = []
for i in range(n):
	sums.append(sum(list(map(int, input().split(' ')))))
t = sums[0]
sums.sort()
sums = sums[::-1]
for (i, x) in enumerate(sums):
	if x == t:
		print(i + 1)
		break


n = int(input())
l = []
for i in range(n):
	sum_score = sum([int(x) for x in input().split()])
	l.append((-sum_score, i))
l = sorted(l)
for i in range(n):
	if l[i][1] == 0:
		print(i + 1)
		break


n = int(input())
l = []
for _ in range(n):
	s = 0
	(a, b, c, d) = list(map(int, input().split()))
	s = s + (a + b + c + d)
	l.append(s)
c = 1
for i in range(1, n):
	if l[0] < l[i]:
		c += 1
print(c)


n = int(input())
a = sorted([(sum(map(int, input().split())), n - id) for id in range(n)])
ans = None
for id in range(n):
	if a[id][1] == n:
		ans = n - id
		break
print(ans)


n = int(input())
x = []
for _ in range(n):
	l = list(map(int, input().split()))
	s = sum(l)
	x.append(s)
y = x[0]
x.sort(reverse=True)
for i in range(n):
	if x[i] == y:
		print(i + 1)
		break


L = {}
for i in range(int(input())):
	L[i + 1] = list(map(int, input().split()))
L = sorted(L.items(), key=lambda x: sum(x[1]), reverse=True)
c = 0
for a in L:
	c += 1
	if a[0] == 1:
		break
print(c)


t = int(input())
k = []
for i in range(t):
	l = list(map(int, input().split()))
	k.append(sum(l))
one = k[0]
k.sort(reverse=True)
print(k.index(one) + 1)


n = int(input())
rank = 1
john = sum(map(int, input().split()))
for i in range(n - 1):
	if sum(map(int, input().split())) > john:
		rank += 1
print(rank)


I = lambda : list(map(int, input().split()))
(n,) = I()
a = [0] * n
temp = 0
for i in range(n):
	a[i] = [sum(I()), i]
temp = a[0][0]
a.sort(reverse=1)
for i in range(n):
	if a[i][0] == temp:
		print(i + 1)
		break


n = int(input())
v = []
(mx, ans) = (0, 1)
for i in range(n):
	sum = 0
	for j in map(int, input().split()):
		sum += j
	v.append(sum * 10000 - i)
for i in range(n):
	if v[i] > v[0]:
		ans += 1
print(ans)


n = int(input())
rank = 1
tmp = 0
for i in range(0, n):
	b = map(int, input().split())
	if i == 0:
		tmp = sum(b)
	if tmp < sum(b):
		rank += 1
print(rank)


import bisect
n = int(input())
thomas = sum(map(int, input().split()))
arr = []
for i in range(n - 1):
	arr.append(sum(map(int, input().split())))
arr = sorted(arr)
print(n - bisect.bisect_right(arr, thomas))


a = int(input())
l = []
s = int(0)
for i in range(a):
	l1 = list(map(int, input().split()))
	for j in range(len(l1)):
		if j == 0:
			l.append(int(0))
		l[i] += l1[j]
	if i != 0:
		if l[0] < l[i]:
			s += 1
print(s + 1)


def raiting_toma(lst):
	b = list()
	for i in range(len(lst)):
		b.append(tuple((sum((int(j) for j in lst[i])), i + 1)))
	c = sorted(b, key=lambda x: x[0], reverse=True)
	d = [c.index(tupl) for tupl in c if tupl[1] == 1]
	return d[0] + 1
n = int(input())
a = list()
for j in range(n):
	z = [int(y) for y in input().split()]
	a.append(z)
print(raiting_toma(a))


n = int(input())
a = []
for j in range(n):
	b = [int(i) for i in input().split()]
	su = 0
	for i in b:
		su += i
	a.append([su, j + 1])
a.sort(reverse=True)
for i in range(n - 1):
	for j in range(i + 1, n):
		if a[i][0] == a[j][0] and a[i][1] > a[j][1]:
			(a[i], a[j]) = (a[j], a[i])
for i in range(n):
	if a[i][1] == 1:
		print(i + 1)
		break


class CodeforcesTask1017ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0
		self.marks = []

	def read_input(self):
		self.n = int(input())
		for a in range(self.n):
			self.marks.append((400 - sum([int(x) for x in input().split(' ')]), a))

	def process_task(self):
		self.marks.sort()
		for i in range(self.n):
			if self.marks[i][1] == 0:
				self.result = str(i + 1)
				break

	def get_result(self):
		return self.result
Solution = CodeforcesTask1017ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
scores = []
thomas_score = 0
for i in range(n):
	score = sum(map(int, input().split(' ')))
	if i == 0:
		thomas_score = score
	scores.append(score)
scores.sort(reverse=True)
print(scores.index(thomas_score) + 1)


n = input()
result = {}
for i in range(int(n)):
	k = list(map(int, input().split()))
	result[i + 1] = sum(k)
k = list(result.items())
k.sort(reverse=True, key=lambda x: x[1])
for i in range(int(n)):
	if k[i][0] == 1:
		print(i + 1)


t = int(input())
mlist = []
for i in range(t):
	l1 = list(map(int, input().split()))
	mlist.append(l1)
s = sum(mlist[0])
r = 1
for i in range(1, t):
	s1 = sum(mlist[i])
	if s < s1:
		r += 1
print(r)


n = int(input())
place = 1
mark = sum(map(int, input().split()))
for i in range(n - 1):
	if sum(map(int, input().split())) > mark:
		place += 1
print(place)


n = int(input())
nlist = []
for i in range(n):
	nlist.append([int(i) for i in input().split()])
thomscore = sum(nlist[0])
thom = 1
for i in range(1, n):
	if thomscore < sum(nlist[i]):
		thom += 1
print(thom)


n = int(input())
s = []
for i in range(n):
	(a, b, c, d) = list(map(int, input().split()))
	s.append((-(a + b + c + d), i))
	if i == 0:
		x = -(a + b + c + d)
s.sort()
print(1 + s.index((x, 0)))


n = int(input())
y = []
for i in range(n):
	x = [int(i) for i in input().split()]
	y.append(sum(x))
ind = [int(i) for i in range(1, n + 1)]
for i in range(len(y) - 1):
	for j in range(i, len(y)):
		if y[i] < y[j]:
			(y[i], y[j]) = (y[j], y[i])
			(ind[i], ind[j]) = (ind[j], ind[i])
while True:
	f = 0
	for i in range(len(y) - 1):
		if y[i] == y[i + 1]:
			if ind[i] > ind[i + 1]:
				f = 1
				(ind[i], ind[i + 1]) = (ind[i + 1], ind[i])
	if f == 0:
		break
print(ind.index(1) + 1)


p = []
for i in range(int(input())):
	a = list(map(int, input().split()))
	p.append(sum(a))
x = p[0]
p.sort(reverse=True)
for i in range(len(p)):
	if p[i] == x:
		print(i + 1)
		break


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

def rev_sort(l):
	l = sorted(l)
	m = []
	for i in range(1, n + 1):
		m.append(l[-i])
	return m

def check_rank(n, l):
	s = []
	d = dict()
	for i in range(n):
		d[i + 1] = sum(l[i])
		s.append(sum(l[i]))
	s = rev_sort(s)
	for i in range(n):
		if d[1] == s[i]:
			return i + 1
print(check_rank(n, I))


n = int(input())
l = []
for i in range(n):
	p = list(map(int, input().split()))
	count = 0
	for i in range(len(p)):
		count += p[i]
	l.append(count)
a = l[0]
l.sort(reverse=True)
for i in range(len(l)):
	if a == l[i]:
		print(i + 1)
		break


n = int(input())
(a, b, c, d) = (int(i) for i in input().split())
s = a + b + c + d
c2 = 0
for i in range(n - 1):
	(a1, b1, c1, d1) = (int(i) for i in input().split())
	if a1 + b1 + c1 + d1 > s:
		c2 += 1
print(c2 + 1)


n = int(input())
total = []
for i in range(n):
	scores = list(map(int, input().split()))
	total.append(sum(scores))
thomas = total[0]
total.sort()
total.reverse()
rank = total.index(thomas) + 1
print(rank)


n = int(input())
L = []
for i in range(1, n + 1):
	sum1 = 0
	x = list(map(int, input().split()))
	sum1 = sum(x)
	L.append(sum1)
	if i == 1:
		z = sum1
L.sort(reverse=True)
for j in range(len(L)):
	if L[j] == z:
		print(j + 1)
		break


n = int(input())
thomas = sum(list(map(int, input().split())))
rank = 1
for _ in range(n - 1):
	marks = sum(list(map(int, input().split())))
	if marks > thomas:
		rank += 1
print(rank)


def sum(a):
	s = 0
	for i in a:
		s = s + i
	return s
n = int(input())
b = []
for i in range(n):
	a = list(map(int, input().split()))
	b.append(sum(a))
x = b[0]
b.sort()
b.reverse()
for i in range(len(b)):
	if x == b[i]:
		print(i + 1)
		break


n = input()
n = int(n)
arr = []
for i in range(n):
	arr1 = input().split()
	arr1 = [int(i) for i in arr1]
	arr.append(sum(arr1))
count = 1
for i in range(1, n):
	if arr[i] > arr[0]:
		count += 1
print(count)


n = int(input())
l = []
for i in range(n):
	b = list(map(int, input().split()))
	c = 0
	for j in b:
		c += j
	l.append(c)
a = l[0]
l.sort(reverse=True)
for i in range(n):
	if l[i] == a:
		print(i + 1)
		break


from sys import stdin

def main():
	input()
	(t, *aa) = list(map(lambda s: sum(map(int, s.split())), stdin.read().splitlines()))
	print(sum((a > t for a in aa)) + 1)
main()


n = int(input())
a = list(map(int, input().split()))
smiths = sum(a)
ans = 1
for i in range(1, n):
	a = list(map(int, input().split()))
	sumi = sum(a)
	if sumi > smiths:
		ans += 1
print(ans)


n = int(input())
a = []
for _ in range(n):
	x = sum(map(int, input().split()))
	a.append(x)
j = a[0]
a.sort(reverse=True)
print(a.index(j) + 1)


n = int(input())
arrx = []
for i in range(n):
	arr = list(map(int, input().split()))
	arrx.append(sum(arr))
ans = 1
for i in range(1, n):
	if arrx[i] > arrx[0]:
		ans += 1
print(ans)


n = int(input())
sm = sum(map(int, input().split()))
ans = 0
for i in range(1, n):
	Sm = sum(map(int, input().split()))
	if Sm > sm:
		ans += 1
print(ans + 1)


n = int(input())
a = []
for i in range(n):
	(b, v, d, e) = map(int, input().split())
	a.append(b + v + d + e)
ans = 1
for i in range(1, n):
	if a[i] > a[0]:
		ans += 1
print(ans)


a = int(input())
x = 0
m = 0
b = []
for i in range(a):
	k = input().split()
	for j in range(len(k)):
		k[j] = int(k[j])
		x += k[j]
	b.append(x)
	x = 0
for c in range(len(b)):
	if b[0] < b[c]:
		m += 1
	else:
		continue
print(m + 1)


t = int(input())
a = []
for i in range(t):
	p = list(map(int, input().split()[:4]))
	a.append(sum(p))
c = a[0]
a.sort(reverse=True)
print(a.index(c) + 1)


n = int(input())
(e, g, m, h) = map(int, input().split())
thomas_mark = e + g + m + h
thomas_rank = 1
for i in range(1, n):
	(e, g, m, h) = map(int, input().split())
	others_mark = e + g + m + h
	if others_mark > thomas_mark:
		thomas_rank += 1
print(thomas_rank)


n = int(input())
s = []
s.append(sum(list(map(int, input().split()))))
x = s[0]
n -= 1
while n > 0:
	s.append(sum(list(map(int, input().split()))))
	n -= 1
s.sort(reverse=True)
print(s.index(x) + 1)


l = []
for t in range(int(input())):
	(a, b, c, d) = [int(i) for i in input().split()]
	l.append(a + b + c + d)
x = l[0]
l.sort(reverse=True)
for i in range(len(l)):
	if x == l[i]:
		print(i + 1)
		break


n = int(input())
a = [[int(x) for x in input().split(' ')] for i in range(n)]
from functools import reduce
b = [reduce(lambda x, y: x + y, a[i]) for i in range(n)]
t = b[0]
b.sort()
b = list(reversed(b))
print(b.index(t) + 1)


n = int(input())
arr = list()
for i in range(n):
	arr.append([sum([int(j) for j in input().split()]), -1 * i])
arr = sorted(arr)
for i in range(n):
	if arr[i][1] == 0:
		print(n - i)
		exit(0)


n = int(input())
a = []
john = 0
for i in range(n):
	lis = []
	lis = list(map(int, input().split()))
	a.append(sum(lis))
john = a[0]
a.sort(reverse=True)
print(a.index(john) + 1)


l = []
for _ in range(int(input())):
	l.append(sum(list(map(int, input().split()))))
k = l[0]
l.sort(reverse=True)
print(l.index(k) + 1)


n = int(input())
(t, arr) = (0, [])
for i in range(n):
	c = [int(x) for x in input().split()]
	cs = sum(c)
	arr.append(cs)
	if i == 0:
		t = cs
arr = sorted(arr, reverse=True)
print(arr.index(t) + 1)


n = int(input())
a = [0] * n
for i in range(n):
	a[i] = sum(list(map(int, input().split())))
k = a[0]
a.sort(reverse=True)
for t in range(n):
	if k == a[t]:
		print(t + 1)
		break


import sys
data = sys.stdin.readlines()[1:]
for i in range(len(data)):
	data[i] = list(map(int, data[i].split()))
listScores = []
for i in range(len(data)):
	listScores.append(sum(data[i]))
scores = listScores
thomasScore = scores[0]
scores = sorted(scores, reverse=True)
thomasRank = scores.index(thomasScore) + 1
print(thomasRank)


n = int(input())
i = 1
lst = []
while i <= n:
	lst.append(sum((int(x) for x in input().split())))
	i += 1
son_score = lst[0]
lst.sort(reverse=True)
print(lst.index(son_score) + 1)


n = int(input())
(maxn, ans) = (sum(list(map(int, input().split()))), 1)
for i in range(1, n):
	summ = sum(list(map(int, input().split())))
	if summ > maxn:
		ans += 1
print(ans)


score = []
for i in range(int(input())):
	a = sum(list(map(int, input().split())))
	score.append(a)
thomas = score[0]
score.sort(reverse=True)
rank = score.index(thomas)
print(rank + 1)


n = int(input())
abcd = [list(map(int, input().split())) for _ in range(n)]
score = []
for i in range(n):
	score.append(sum(abcd[i]))
t = score[0]
score.sort(reverse=True)
for j in range(n):
	if score[j] == t:
		print(j + 1)
		break


n = int(input())
s = []
for i in range(n):
	s.append(sum([int(x) for x in input().split()]))
tgt = s[0]
s = sorted(s, reverse=True)
for i in range(n):
	if s[i] == tgt:
		print(i + 1)
		break


x = int(input())
mark = [[j for j in input().split()] for i in range(x)]
markhis = 0
markfriends = 0
rank = 1
for ii in range(4):
	markhis += int(mark[0][ii])
for newmark in range(1, x):
	for current_marks in range(4):
		markfriends += int(mark[newmark][current_marks])
	if markfriends > markhis:
		rank += 1
	markfriends = 0
print(rank)


n = int(input())
rank = []
thomas = 0
for x in range(n):
	score = list(map(int, input().strip().split()))
	s1 = sum(score)
	if x == 0:
		thomas = s1
	rank.append(s1)
rank.sort(reverse=True)
print(rank.index(thomas) + 1)


n = int(input())
sum = 0
ans = 1
for x in input().split():
	sum += int(x)
while n > 1:
	n -= 1
	now = 0
	for x in input().split():
		now += int(x)
	if now > sum:
		ans += 1
print(ans)


t = []
y = []
for i in range(int(input())):
	g = list(map(int, input().split()))
	t.append([sum(g), i + 1])
	y.append(sum(g))
t.sort()
s = t[::-1]
for k in range(len(s)):
	if s[k][1] == 1:
		if y.count(y[0]) > 1:
			print(k + 1 - (y.count(y[0]) - 1))
			break
		else:
			print(k + 1)
			break


n = int(input())
ans = 1
sum_ = 0
for i in range(1, n + 1):
	(a, b, c, d) = map(int, input().split())
	temp_sum = a + b + c + d
	if i == 1:
		sum_ = temp_sum
	elif temp_sum > sum_:
		ans += 1
print(ans)


n = int(input())
t = []
for i in range(n):
	t.append(sum([int(i) for i in input().split()]))
tom = t[0]
t.sort(reverse=True)
print(t.index(tom) + 1)


n = int(input())
students = []
for i in range(1, n + 1):
	(a, b, c, d) = map(int, input().split())
	s = a + b + c + d
	students.append((i, s))
students.sort(key=lambda s: s[1], reverse=True)
j = 1
for (i, s) in students:
	if i == 1:
		print(j)
		break
	j += 1


t = int(input())
sum_ = []
for i in range(t):
	arr = list(map(int, input().split()))
	sum_.append(sum(arr))
thomas = sum_[0]
sum_ = sorted(sum_)
sum_.reverse()
print(sum_.index(thomas) + 1)


s = []
for _ in range(int(input())):
	s.append(sum(list(map(int, input().split()))))
s = list(enumerate(s))
s.sort(key=lambda i: i[1], reverse=True)
for i in range(len(s)):
	if s[i][0] == 0:
		print(i + 1)
		break


p = int(input())
ln = []
for i in range(1, p + 1):
	(n1, n2, n3, n4) = map(int, input().split())
	n = n1 + n2 + n3 + n4
	ln.append(n)
nt = ln[0]
ln.sort()
ln.reverse()
print(ln.index(nt) + 1)


n = int(input())
l = []
k = 1
for i in range(n):
	(x, y, z, m) = input().split()
	x = int(x)
	y = int(y)
	z = int(z)
	m = int(m)
	a = x + y + z + m
	l.append(a)
for j in range(n):
	if l[0] < l[j]:
		k = k + 1
print(k)


n = int(input())
students_grades = [0] * n
for i in range(n):
	entrada = str(input())
	students_grades[i] = [sum([int(x) for x in entrada.split()]), n - i - 1]
students_grades.sort()
rank = 0
for i in range(n):
	if students_grades[i][1] == n - 1:
		rank = n - i
print(rank)


a = int(input())
z = 0
s = []
k = []
for i in range(a, 0, -1):
	b = list(map(int, input().split()))
	s.append(b[0] + b[1] + b[2] + b[3])
	k.append(b[0] + b[1] + b[2] + b[3])
s.sort()
s.reverse()
print(s.index(k[0]) + 1)


n = int(input())
listy = []
for i in range(n):
	sumr = 0
	lis = list(map(int, input().split()))
	for i in lis:
		sumr += i
	listy.append(sumr)
thomas = listy[0]
listy.sort()
listy.reverse()
ans = listy.index(thomas)
print(ans + 1)


I = lambda : list(map(int, input().split()))
import collections as cc
(n,) = I()
a = cc.defaultdict(list)
for i in range(1, n + 1):
	a[sum(I())].append(i)
c = 0
te = list(sorted(a.keys()))
te = te[::-1]
for i in te:
	if 1 not in a[i]:
		c += len(a[i])
	else:
		t = sorted(a[i])
		c += t.index(1) + 1
		break
print(c)


n = int(input())
ls = []
for i in range(n):
	a = list(map(int, input().split()))
	s = a[0] + a[1] + a[2] + a[3]
	ls.append((s, i + 1))
ls.sort(key=lambda e: e[0], reverse=True)
for i in range(n):
	if ls[i][1] == 1:
		print(i + 1)


number = int(input())
(data, result) = ([], 1)
for a in range(number):
	tem_data = list(map(int, input().split()))
	data.append(sum(tem_data))
john_son = data[0]
for b in data:
	if b > john_son:
		result += 1
print(result)


n = int(input())
sum1 = 0
ans = 1
for t in range(n):
	(a, b, c, d) = map(int, input().split())
	sum = a + b + c + d
	if t == 0:
		sum1 = sum
	if sum > sum1:
		ans += 1
print(ans)


n = int(input())
q = []
for i in range(n):
	l = list(input().split())
	l = [int(j) for j in l]
	q.append(sum(l))
rank = 1
for i in q:
	if i > q[0]:
		rank += 1
	else:
		continue
print(rank)


n = int(input())
result = []
for i in range(n):
	result.append(sum(map(int, input().split())))
jim_score = result[0]
result = sorted(result, reverse=True)
print(result.index(jim_score) + 1)


x = int(input())
sum1 = 1
m = sum(map(int, input().split()))
for i in range(x - 1):
	n = sum(map(int, input().split()))
	if n > m:
		sum1 += 1
print(sum1)


n = int(input())
nilai1 = 0
nilai2 = 0
hasil = 1
for i in range(n):
	nilai = input().split()
	if i == 0:
		for j in nilai:
			nilai1 += int(j)
	else:
		nilai2 = 0
		for j in nilai:
			nilai2 += int(j)
	if nilai1 < nilai2:
		hasil += 1
print(hasil)


n = int(input())
R = 1
Q = sum(list(map(int, input().split())))
for i in range(n - 1):
	N = sum(list(map(int, input().split())))
	if N > Q:
		R += 1
print(R)


n = int(input())
(a0, b0, c0, d0) = map(int, input().split())
x = 1
s0 = a0 + b0 + c0 + d0
for i in range(n - 1):
	(a, b, c, d) = map(int, input().split())
	s = a + b + c + d
	if s > s0:
		x += 1
print(x)


n = int(input())
l = []
for i in range(n):
	c = list(map(int, input().split()))
	l.append(sum(c))
m = l[0]
l.sort(reverse=True)
for i in range(len(l)):
	if m == l[i]:
		print(i + 1)
		break


n = int(input())
s = 1
a = list(map(int, input().split()))
res = sum(a)
for i in range(n - 1):
	t = list(map(int, input().split()))
	if sum(t) > res:
		s += 1
print(s)


n = int(input())
count = 0
(eng, ger, math, hist) = input().split(' ')
(eng, ger, math, hist) = (int(eng), int(ger), int(math), int(hist))
sum = eng + ger + math + hist
for i in range(n - 1):
	(eng, ger, math, hist) = input().split(' ')
	(eng, ger, math, hist) = (int(eng), int(ger), int(math), int(hist))
	sum2 = eng + ger + math + hist
	if sum2 > sum:
		count = count + 1
print(count + 1)


l = []
m = 0
for i in range(int(input())):
	n = sum(map(int, input().split()))
	if i == 0:
		m = n
	l.append(n)
l.sort(reverse=True)
for (i, j) in enumerate(l):
	if m >= j:
		print(i + 1)
		break


import sys
n = int(input())
a = [] * n
for i in range(n):
	b = [int(el) for el in input().split()]
	a.append([sum(b), i])
z = a[0][0]
a.sort()
a.reverse()
b = []
k = 0
for i in a:
	if i[0] == z:
		kz = k
		b.append(i[1])
	else:
		k += 1
b.sort()
k = 1
for i in b:
	if i == 0:
		print(kz + k)
	else:
		k += 1


rankList = []
for id in range(int(input())):
	s = sum(map(int, input().split()))
	rankList.append((id + 1, s))
rankList.sort(key=lambda x: x[1], reverse=True)
for i in range(len(rankList)):
	id = rankList[i][0]
	if id == 1:
		print(i + 1)


N = int(input())
a = []
for n in range(N):
	nums = list(map(int, input().split()))
	a.append((-sum(nums), n))
a.sort()
for (i, (_, n)) in enumerate(a):
	if n == 0:
		print(i + 1)


q = 0
m = 0
a = []
n = int(input())
b = sum(map(int, input().split()))
for i in range(n - 1):
	a.append(sum(map(int, input().split())))
a = sorted(a)
for i in range(len(a) - 1, -1, -1):
	m += 1
	if a[i] <= b:
		q = 1
		break
if q == 0:
	print(n)
else:
	print(m)


n = int(input())
stud = [sum([int(x) for x in input().split()]) for i in range(n)]
rank = sorted(stud, reverse=True)
for i in range(n):
	if stud[0] == rank[i]:
		print(i + 1)
		break


(a, d) = (int(input()), [500, sum([int(i) for i in input().split()])])
for i in range(2, a + 1):
	d.append(sum([int(i) for i in input().split()]))
print(sorted(d, reverse=True).index(d[1]))


n = int(input())
scores_sum = []
thomas_score = 0
for i in range(n):
	score_sum = sum(map(int, input().split()))
	if i == 0:
		thomas_score = score_sum
	scores_sum.append(score_sum)
scores_sum.sort(reverse=True)
print(scores_sum.index(thomas_score) + 1)


n = int(input())
max = 0
j = 1
ts = sum([int(x) for x in input().split()])
for i in range(n - 1):
	a = sum([int(x) for x in input().split()])
	if a > ts:
		j += 1
print(j)


n = int(input())
l = []
for i in range(n):
	a = [int(x) for x in input().split()]
	l.append(sum(a))
b = []
b = sorted(l)
for j in range(n):
	if l[0] == b[n - 1 - j]:
		print(j + 1)
		break


def sorting(n, array):
	list_of_sum = list(set([sum(x) for x in array]))
	list_of_sum = sorted(list_of_sum, reverse=True)
	res = []
	for index in list_of_sum:
		temp = []
		for scores in array:
			if sum(scores) == index:
				temp.append(scores)
		res = res + temp
	return res

def rankingforSon(n, array):
	scores_of_son = array[0]
	temp = sorting(n, array)
	for (key, val) in enumerate(temp):
		if val == scores_of_son:
			return key + 1
n = int(input())
array = [[int(x) for x in input().split(' ')] for _ in range(n)]
print(rankingforSon(n, array))


repetition = int(input()) - 1
num = 1
sum1 = sum(list(map(int, input().split())))
for i in range(repetition):
	if sum1 < sum(list(map(int, input().split()))):
		num += 1
print(num)


from collections import defaultdict

def go():
	n = int(input())
	scores = set()
	s = defaultdict(list)
	for i in range(n):
		(a, b, c, d) = [int(x) for x in input().split(' ')]
		scores.add(a + b + c + d)
		s[a + b + c + d].append(i)
	scores = sorted(scores)
	rank = 1
	while scores:
		cur = scores.pop(-1)
		for i in s[cur]:
			if i == 0:
				return rank
			else:
				rank += 1
	return rank
print(go())


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

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

def li():
	return list(mi())
n = ii()
a = [(sum(list(map(int, input().split()))), -i) for i in range(n)]
a.sort(reverse=True)
for i in range(n):
	if a[i][1] == 0:
		print(i + 1)


n = int(input())
a = list()
b = list()
c = list()
d = list()
for i in range(n):
	inp = list(input().split())
	a.append(int(inp[0]))
	b.append(int(inp[1]))
	c.append(int(inp[2]))
	d.append(int(inp[3]))
stm = list()
for i in range(n):
	stm.append(a[i] + b[i] + c[i] + d[i])
thomas = stm[0]
pos = 1
for i in range(n):
	if stm[i] > thomas:
		pos += 1
print(pos)


n = int(input())
count = 1
id_1 = sum(list(map(int, input().split())))
for i in range(n - 1):
	id_i = sum(list(map(int, input().split())))
	if id_i > id_1:
		count += 1
print(count)


n = int(input())
L = []
while n > 0:
	n = n - 1
	a = list(map(int, input().split()))
	L.append(sum(a))
t = L[0]
L = sorted(L, reverse=True)
for i in range(len(L)):
	if L[i] == t:
		print(i + 1)
		break


(x, arr) = (int(input()), [])
need = 0
for i in range(x):
	(a, b, c, d) = map(int, input().split())
	if i == 0:
		need = a + b + c + d
	arr.append(a + b + c + d)
arr = sorted(arr, reverse=True)
for i in range(x):
	if arr[i] == need:
		print(i + 1)
		break


n = int(input())
thomas_score = sum(map(int, input().split()))
rank = 1
for _ in range(n - 1):
	other_score = sum(map(int, input().split()))
	if other_score > thomas_score:
		rank += 1
print(rank)


n = int(input())
s = [[int(x) for x in input().split()] for _ in range(n)]
p = -1
rank = 0
stock = 0
for (tot, i) in sorted([(sum(x), i + 1) for (i, x) in enumerate(s)], reverse=True):
	if tot == p:
		stock += 1
	else:
		rank += stock + 1
		stock = 0
		p = tot
	if i == 1:
		print(rank)
		break


n = int(input())
score_table = []
if n >= 1 and n <= 1000:
	for id in range(n):
		info = input().split()
		for (num, i) in enumerate(info):
			info[num] = int(i)
		info.insert(0, id + 1)
		info.insert(5, info[1] + info[2] + info[3] + info[4])
		score_table.append(info)
	for loop in range(len(score_table) - 2):
		for student in range(len(score_table) - 1):
			total_score_A = score_table[student][5]
			total_score_B = score_table[student + 1][5]
			if total_score_A < total_score_B:
				score_table.insert(student + 2, score_table[student])
				score_table.pop(student)
			if total_score_A == total_score_B:
				if score_table[student][0] > score_table[student + 1][0]:
					score_table.insert(student + 2, score_table[student])
					score_table.pop(student)
	for rank in range(len(score_table)):
		if score_table[rank][0] == 1:
			print(rank + 1)


l = []

def f(l, c):
	for i in range(len(l)):
		if l[i] == c:
			return i + 1
for i in range(int(input())):
	l1 = list(map(int, input().split()))
	sum = 0
	for j in range(4):
		sum += l1[j]
	if i == 0:
		c = sum
	l.append(sum)
l.sort(reverse=True)
print(f(l, c))


a = int(input())
nums = [int(x) for x in input().split(' ')]
Thom = sum(nums)
rank = 1
for i in range(a - 1):
	nums = [int(x) for x in input().split(' ')]
	if sum(nums) > Thom:
		rank += 1
print(rank)


def mmhaxor(mht, n):
	thomas_score = sum(mht[0])
	aumm = []
	for i in range(n):
		aumm.append(sum(mht[i]))
	aumm.sort(reverse=True)
	for i in range(n):
		if thomas_score == aumm[i]:
			print(i + 1)
			break
n = int(input())
mht = []
for i in range(n):
	a = list(map(int, input().split()))
	mht.append(a)
mmhaxor(mht, n)


def Tokitsukaze():
	n = int(input())
	TomasScore = 0
	TomasScore += sum(list(map(int, input().split())))
	scores = [TomasScore]
	for i in range(n - 1):
		scores.append(sum(list(map(int, input().split()))))
	scores.sort(reverse=True)
	print(scores.index(TomasScore) + 1)
Tokitsukaze()


import sys
data = sys.stdin.readlines()[1:]
for i in range(len(data)):
	data[i] = list(map(int, data[i].split()))
l = []
for i in data:
	l.append(sum(i))
t = l[0]
l.sort()
l.reverse()
print(l.index(t) + 1)


def comp(a):
	return a[1]
n = int(input())
m = []
tomas = 0
for i in range(n):
	bm = []
	(a, b, c, d) = map(int, input().split())
	if i == 0:
		tomas = a + b + c + d
	m.append((i + 1, a + b + c + d))
m.sort(key=comp, reverse=True)
for i in range(n):
	if m[i][1] == tomas and m[i][0] == 1:
		print(i + 1)


import operator
num = int(input())
scores = {}
for n in range(num):
	total = sum(list(map(int, input().split())))
	scores[n] = total
scores_sorted = sorted(scores.items(), key=operator.itemgetter(1), reverse=True)
print(scores_sorted.index((0, scores[0])) + 1)


n = int(input())
lst = []
for i in range(n):
	n1 = list(map(int, input().split()))
	s = sum(n1)
	lst.append(s)
w = lst[0]
lst.sort()
lst.reverse()
print(lst.index(w) + 1)


students = []
for i in range(int(input())):
	students.append([i, sum(map(int, input().split()))])
students.sort(key=lambda x: (-x[1], x[0]))
for (i, student) in enumerate(students):
	if student[0] == 0:
		print(i + 1)
		break


from collections import namedtuple
record = namedtuple('record', ['id', 'score'])
m = list(map(int, input().split()))[0]
records = (record(i, sum(list(map(int, input().split())))) for i in range(m))
for (idx, x) in enumerate(sorted(records, key=lambda x: x.score, reverse=True)):
	if x.id == 0:
		print(idx + 1)
		break


n = int(input())
l = [(sum(map(int, input().split())), i) for i in range(n)]
l.sort(key=lambda t: t[0], reverse=True)
print([i for (s, i) in l].index(0) + 1)


n = int(input())
place = 1
for i in range(n):
	if i == 0:
		s_1 = sum(map(int, input().split()))
	elif sum(map(int, input().split())) > s_1:
		place += 1
print(place)


n = int(input())
tab = [list(map(int, input().split())) for i in range(n)]
sumy = []
index = 0
for i in tab:
	sumy.append((sum(i), index))
	index += 1
sumy.sort(key=lambda x: (-x[0], x[1]))
for i in range(len(sumy)):
	if sumy[i][1] == 0:
		print(i + 1)
		exit()


n = int(input())
lis = []
dicti = {}
for i in range(n):
	mark = [int(i) for i in input().split()]
	dicti[i + 1] = sum(mark)
key = dicti[1]
count = 0
for i in range(2, n + 1):
	if dicti[i] > key:
		count += 1
print(count + 1)


n = int(input().strip())
s = {}
for i in range(n):
	a = list(map(int, input().strip().split()))
	s[i + 1] = sum(a)
r = sorted(s.keys(), key=lambda x: s[x], reverse=True)
i = 0
for ri in r:
	if ri == 1:
		print(i + 1)
		break
	i += 1


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


n = int(input())
scores = []
for i in range(n):
	grades = sum([int(c) for c in input().split()])
	scores.append((i + 1, grades))
scores.sort(key=lambda x: x[1], reverse=True)
for (k, (idx, _)) in enumerate(scores, 1):
	if idx == 1:
		print(k)
		break


n = int(input())
lis = []
s = []
for i in range(0, n):
	a = list(map(int, input().split()))
	s.append(sum(a))
	lis.append(a)
j = s[0]
s.sort(reverse=True)
d = s.index(j)
print(d + 1)


n = int(input())
ar = sorted([[-sum(list(map(int, input().split()))), i] for i in range(1, n + 1)])
i = 0
for a in ar:
	if a[1] == 1:
		break
	i += 1
print(i + 1)


from sys import stdin
from bisect import bisect_left
input()
students = list(map(lambda line: -sum(map(int, line.split())), stdin.readlines()))
ans = bisect_left(sorted(students[1:]), students[0]) + 1
print(ans)


n = int(input())
a = []
s0 = 0
for i in range(n):
	s = sum(list(map(int, input().split())))
	if i == 0:
		s0 = s
	a.append((s, i))
print(sorted(a, key=lambda x: (-x[0], x[1])).index((s0, 0)) + 1)


from __future__ import print_function
import sys
import math
import os.path
from copy import deepcopy
from functools import reduce
from collections import Counter, ChainMap, defaultdict
from itertools import cycle, chain
from queue import Queue, PriorityQueue
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, nlargest, nsmallest
import bisect
from statistics import mean, mode, median, median_low, median_high
sys.setrecursionlimit(10 ** 9)

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

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

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

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

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}

def sortId(arr):
	return sorted(range(len(arr)), key=lambda k: arr[k])
(n,) = ni()
a = [0] * n
for i in range(n):
	(e, g, m, h) = ni()
	a[i] = (e + g + m + h, -i)
ia = a[0]

def cmpa(a, b):
	return
a.sort(reverse=True)
print(a.index(ia) + 1)


n = int(input())
thomas = sum(map(int, input().split(' ')))
place = 1
for i in range(0, n - 1):
	if sum(map(int, input().split(' '))) > thomas:
		place += 1
print(place)


n = int(input())
b = []
for j in range(n):
	a = [int(s) for s in input().split()]
	b.append(0)
	for i in range(len(a)):
		b[j] += a[i]
c = b[0]
b.sort()
b = b[::-1]
for i in range(n):
	if b[i] == c:
		print(i + 1)
		break


students = int(input())
sums = list()
for x in range(0, students):
	scores = input().split()
	scores = list(map(int, scores))
	sums.append(sum(scores))
thomas = sums[0]
sums.sort(reverse=True)
rank = sums.index(thomas)
print(rank + 1)


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	N = Scanner.int()
	S = [0 for _ in range(N)]
	for i in range(N):
		(a, b, c, d) = Scanner.map_int()
		S[i] = (i, a + b + c + d)
	S.sort(reverse=True, key=lambda x: x[1])
	for (i, s) in enumerate(S):
		if s[0] == 0:
			print(i + 1)
			return
main()


class st:
	id = None
	sum = None

	def __init__(self, id, sum):
		self.id = id
		self.sum = sum
n = input()
a = []
b = []
t = 0
for i in range(0, int(n)):
	(b, c, d, e) = input().split()
	sum = int(b) + int(c) + int(d) + int(e)
	a.append(st(i, sum))
a.sort(key=lambda st: st.sum, reverse=True)
for i in range(0, len(a)):
	if a[i].id == 0:
		print(i + 1)
		break


n = int(input())
k = [0] * n
for i in range(0, n):
	b = input().split()
	b = list(map(int, b))
	b = sum(b)
	k[i] = (i + 1, b)
m = k[0][1]
r = 1
for i in range(n):
	if k[i][1] > m:
		r = r + 1
print(r)


n = int(input())
data = []
for i in range(n):
	a = [int(v) for v in input().split()]
	data.append((-sum(a), i))
data.sort()
for (j, (_, i)) in enumerate(data):
	if i == 0:
		print(j + 1)
		break


k = int(input())
a = []
for i in range(k):
	s = [int(x) for x in input().split()]
	a.append(sum(s))
c = 0
for i in range(len(a)):
	if a[i] > a[0]:
		c += 1
print(c + 1)


n = int(input())
ans = []
for _ in range(n):
	x = list(map(int, input().strip().split()))
	ans.append(sum(x))
temp = ans[0]
vns = sorted(ans)[::-1]
print(vns.index(temp) + 1)


n = int(input())
grade = []
sortlist1 = []
for i in range(0, n):
	sum1 = 0
	(a, b, c, d) = map(int, input().split())
	sum1 = a + b + c + d
	grade.append(sum1)
	sortlist1.append(sum1)
grade.sort(reverse=True)
for i in range(n):
	if sortlist1[0] == grade[i]:
		print(i + 1)
		break


a = []
k = 0
n = int(input())
for i in range(n):
	b = list(map(int, input().split()))
	a.append(b)
c = []
for i in range(len(a)):
	d = sum(a[i])
	c.append(d)
p = c[0]
for i in range(len(c)):
	for j in range(len(c) - 1, i, -1):
		if c[j] > c[j - 1]:
			(c[j], c[j - 1]) = (c[j - 1], c[j])
for i in range(len(c)):
	if p == c[i]:
		k = i + 1
		break
print(k)


n = int(input())
table = dict()
for i in range(n):
	l = map(int, str(input()).split(' '))
	table[i + 1] = sum(l)
print([v[0] for v in sorted(table.items(), key=lambda kv: (-kv[1], kv[0]))].index(1) + 1)


def solve():
	n = int(input())
	rank = 1
	Thomas_score = sum([int(x) for x in input().split(' ')])
	for i in range(n - 1):
		if Thomas_score < sum([int(x) for x in input().split(' ')]):
			rank += 1
	print(rank)
solve()


n = int(input())
l = []
while n:
	n -= 1
	(a, b, c, d) = [int(x) for x in input().split()]
	sum1 = a + b + c + d
	l.append(sum1)
rank = 1
for i in range(len(l) - 1):
	if l[0] < l[i + 1]:
		rank += 1
print(rank)


n = int(input())
arr = []
for i in range(n):
	s = sum(map(int, input().split()))
	arr.append((s, n - 1 - i))
arr.sort()
for i in range(n):
	(a, b) = arr[i]
	if b is n - 1:
		print(n - i)


from math import *
from itertools import *
from collections import *
from bisect import *
n = int(input())
lst = []
for i in range(1, n + 1):
	sm = sum([int(x) for x in input().split()])
	lst.append((-sm, i))
lst.sort()
for (idx, t) in enumerate(lst):
	if t[1] == 1:
		print(idx + 1)
		break


x = []
for _ in range(int(input())):
	(a, b, c, d) = list(map(int, input().split()))
	sum = a + b + c + d
	x.append(sum)
t = x[0]
x.sort(reverse=True)
for i in range(len(x)):
	if x[i] == t:
		print(i + 1)
		break


a = int(input())
cont = 1
d = list(map(int, input().split()))
punt = sum(d)
for i in range(a - 1):
	d = list(map(int, input().split()))
	e = sum(d)
	if e > punt:
		cont += 1
print(cont)


n = int(input())
arr = list(map(int, input().split()))
my_score = sum(arr)
scores = [my_score]
for i in range(n - 1):
	arr = list(map(int, input().split()))
	scores.append(sum(arr))
scores.sort(reverse=True)
print(scores.index(my_score) + 1)


n = int(input())
l = list(map(int, input().strip().split()))
count = 1
r = sum(l)
for i in range(n - 1):
	l = list(map(int, input().strip().split()))
	r1 = sum(l)
	if r1 > r:
		count = count + 1
print(count)


n = int(input())
a = [sum(map(int, input().split())) for _ in range(n)]
print(sum((v > a[0] for v in a[1:])) + 1)


def sum_input():
	return sum(map(int, input().split()))
n = int(input())
v = sum_input()
print(sum([sum_input() > v for _ in range(1, n)]) + 1)


second = []
for i in range(int(input())):
	first = list(map(int, input().split()))
	second.append(sum(first))
temp = second[0]
second.sort()
second.reverse()
print(second.index(temp) + 1)


t = int(input())
sc = []
for i in range(t):
	sc.append(sum([int(x) for x in input().split(' ')]))
thom = sc[0]
sc = sorted(sc, reverse=True)
print(sc.index(thom) + 1)


t = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = 1
t -= 1
while t:
	t -= 1
	a = list(map(int, input().split()))
	b = sum(a)
	if b > s:
		ans += 1
print(ans)


student = int(input())
Thomas = sum([int(v) for v in input().split()])
rank = 1
for i in range(student - 1):
	score = sum([int(u) for u in input().split()])
	if score > Thomas:
		rank += 1
	else:
		pass
print(rank)


n = int(input())
r = range(0, -n, -1)
print(n - [i for (_, i) in sorted(zip(map(sum, (map(int, input().split()) for _ in r)), r))].index(0))


n = int(input())
l = list(map(int, input().split()))
sum1 = 0
for i in l:
	sum1 += i
sum2 = 0
rank = 1
for i in range(n - 1):
	sum2 = 0
	l1 = list(map(int, input().split()))
	for i in l1:
		sum2 += i
	if sum2 > sum1:
		rank += 1
print(rank)


def merge_sort(A):
	if len(A) <= 1:
		return A
	else:
		L = A[:len(A) // 2]
		R = A[len(A) // 2:]
		return merge(merge_sort(L), merge_sort(R))

def merge(A, B):
	i = 0
	j = 0
	Ans = []
	while i < len(A) and j < len(B):
		if A[i][1] > B[j][1]:
			Ans.append(A[i])
			i += 1
		elif A[i][1] < B[j][1]:
			Ans.append(B[j])
			j += 1
		elif A[i][0] > B[j][0]:
			Ans.append(B[j])
			j += 1
		else:
			Ans.append(A[i])
			i += 1
	Ans += A[i:] + B[j:]
	return Ans
n = int(input())
A = [[i] * 2 for i in range(n)]
for i in range(n):
	(a, b, c, d) = map(int, input().split())
	A[i][1] = a + b + c + d
A = merge_sort(A)
for i in range(n):
	if A[i][0] == 0:
		print(i + 1)
		break


t = int(input())
scores = {}
for id in range(1, t + 1):
	s = 0
	marks = [int(x) for x in input().split(' ')]
	for i in marks:
		s += i
	scores[id] = s
sortedScores = [(k, scores[k]) for k in sorted(scores, key=scores.get, reverse=True)]
for x in range(t):
	if sortedScores[x][0] == 1:
		print(x + 1)
		break