a=0
max=0
for i in range(7):
l,m=map(int,input(":").split()) if l+m>max and l+m>8: max=l+m a=i+1
print(a)