Help me in solving TLG problem

My issue

i’m able figure-out the issue in loop statements?

My code

# cook your dish here
t = int(input())
for _ in range(t):
    n,n1 = map(int,input().split())
    p1=0
    p2=0
    m1=0
    m2=0
    m1 += n
    m2 += n1
    if m1>m2:
        p1 = max(p1,m1-m2)
    else:
        p2 = max(p2,m2-m1)
if p1>p2:
    print(1,p1)
else:
    print(2,p2)
    

Problem Link: TLG Problem - CodeChef