the following code works fine but i am not able to submit it . can anyone spot the obvious that i might be missing?
l1=[]
l2=[]
n=int(input())
for _ in range(n):
p1,p2=map(int,str(input()).split())
l1.append([p1,p2])
for x in l1:
if x[0]>x[1]:
l2.append([1,abs(x[0]-x[1])])
else:
l2.append([2,abs(x[0]-x[1])])
l2.sort(key = lambda x: x[1])
print(l2[n-1][0],l2[n-1][1])