# -*- coding: utf-8 -*-
"""
Created on Thu Apr 5 21:07:50 2018
@author: wdf
"""
max=0
j=0
for i in range(0,7):
x=input()
xlist=x.split(" ")
x = int(xlist[0]) #x[i]表示school time
n = int(xlist[1]) #n[i]表示mother time
if (x+n)>8:
if(max<(x+n)):
max=x+n
j=i
print (j+1)
"""
Created on Thu Apr 5 21:07:50 2018
@author: wdf
"""
max=0
j=0
for i in range(0,7):
x=input()
xlist=x.split(" ")
x = int(xlist[0]) #x[i]表示school time
n = int(xlist[1]) #n[i]表示mother time
if (x+n)>8:
if(max<(x+n)):
max=x+n
j=i
print (j+1)