t = int(input())
l,a,b = 0,0,0
for i in range(0,t):
c,d = map(int,input().split())
a += c
b += d
if (a>b):
w = 1
l = (a-b)
elif (a<b):
w = 2
l = (b-a)
print("{} {}".format(w,l))
t = int(input())
l,a,b = 0,0,0
for i in range(0,t):
c,d = map(int,input().split())
a += c
b += d
if (a>b):
w = 1
l = (a-b)
elif (a<b):
w = 2
l = (b-a)
print("{} {}".format(w,l))
Store lead for each round and use the cumulative score to find that lead, only the round in which the lead is maximum is considered for deciding the winner.
Just like in the explained example the round 1 has a maximum lead of 58. So, only Round 1 is considered for deciding the winner.
thanks man for clearing my doubt. this is really helpful for me. i am from India. my email-id is [email protected]. You can contact me if you want to.
:))…