s=0 c=1 for i in range(1,8): a,b=list(map(int,input().split())) if s>=a+b: s=s c=c else: s=a+b c=i if s>7: print(c) else: print(0)