rounds = int(input())
scores = []
play1 = []
play2 = []
lead1 = []
lead2 = []
for i in range(0,rounds):
scores.append(input().split())
play1.append(int(scores[i][0]))
play2.append(int(scores[i][1]))
i=0
for i in range(0,rounds):
if (play1[i] - play2[i]) > 0:
lead1.append(play1[i] - play2[i])
else:
lead2.append(play2[i] - play1[i])
a = max(lead1)
b = max(lead2)
if a > b:
print(1,a)
else:
print(2,b)