n=int(input()) ans=-1 res=-1 for i in range(n): g,d=map(int,input().split()) if res