t = int(input())
list1,list2 = [],[]
for i in range(0,t):
c,d = map(int,input().split())
list1.append(c)
list2.append(d)
l,w,win = 0,0,0
for i in range(t):
w = abs(list1[i]-list2[i])
if w>l:
l = w
if list1[i]>list2[i]:
win = 1
else :
win = 2
print(win,l)