Help in the code

Can anyone find out the error in this code?
Problem Code: TLG
The Lead Game

N = input()
N = int(N)
p1 = []
p2 = []

def lead(p1, p2):
p1_max = max(p1)
p2_max = max(p2)

if p1_max > p2_max:
    return "{} {}".format("1", p1_max)
elif p1_max < p2_max:
    return "{} {}".format("2", p2_max)

for _ in range(N):
a, b = map(int, input().split())
if a > b:
p1.append(a - b)
elif a < b:
p2.append(b - a)
print(lead(p1, p2))