Skip to content

Instantly share code, notes, and snippets.

@uroybd
Last active July 18, 2016 14:54
Show Gist options
  • Save uroybd/619a53e20814ae043e29b133d20fbc40 to your computer and use it in GitHub Desktop.
Save uroybd/619a53e20814ae043e29b133d20fbc40 to your computer and use it in GitHub Desktop.
URI 1914
def verdict(P1,P2,C1,C2,M,N):
if (M + N) % 2 == 0:
v = 'PAR'
else:
v = 'IMPAR'
if C1 == v:
return P1
else:
return P2
QT = int(input())
for i in range(QT):
p1, c1, p2, c2 = input().split(' ')
m, n = list(map(lambda x: int(x), input().split()))
print(verdict(p1,p2,c1,c2,m,n))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment