N=int(input()) X = [[int(i) for i in input(). split ()] for i in range(N)] d=X[0][1]-X[0][0] if d<=0: print (-1) else: nd=1 i=1 while nd==1 and i