n = input() s = set() for i in range(n): a,b = map(int, raw_input().split()) s.add(b - a) if (len(s) == 1): print max(s.pop(), -1) else: print -1