problem url : `https://www.codechef.com/problems/TLG`

n=int(input())

x=[]

y=[]

lp=[]

w=[]

for i in range(0,n):

a,b=input().split()

x.append(a)

y.append(b)

for i in range(0,n):

lp.append(abs(int(x[i]) - int(y[i])))

if int(x[i]) > int(y[i]):

w.append(1)

else:

w.append(2)

r=lp.index(max(lp))

print(w[r],lp[r])