n=int(input());a=[] for _ in range(n): x,y=map(int,input().split()) a.append(y-x) if len({*a})>1 or (y-x)<1: print(-1) else: print(*{*a})