I=input l=[] n=int(I()) for i in '.'*n:a,b=map(int,input().split());l+=[b-a] print(b-a if len(set(l)) else -1)