I tried to find the mistake in my code, but i couldn’t. It seems (to me) to be right.
t = int(input())
w = []
d = []
for i in range (t):
a,b = map(int, input().split())
if a > b:
w += [1]
else:
w += [2]
d += [abs(a-b)]
print (str(w[d.index(max(d))]), str(max(d)))