what is problem in my code?

n=int(input())
p1=0
p2=0
l=0
for i in range(n):
s1,s2=list(map(int,input().split()))
c=abs(s1-s2)
if(c>=l and s1>s2):
l=c
p1=1
p2=0
elif(c>=l and s2>s1):
l=c
p2=1
p1=0
if(p1==1):
print(1,l,sep=" “)
if(p2==1):
print(2,l,sep=” ")