bapc-prelim-2016/a.py
Felix C. Stegerman 92f4613489 ...
2016-09-24 14:36:12 +02:00

26 lines
441 B
Python

from __future__ import print_function
import sys
n, m = sys.stdin.readline().split()
n, m = int(n), int(m)
n, m = max(n, m), min(n, m)
l = []
l.append((n, m))
while m != 0:
n, m = m, n % m
l.append((n, m))
l.reverse()
wins = [False]
for i in range(len(l) - 1):
if not wins[i]:
wins.append(True)
elif l[i + 1][0] == l[i][0] + l[i][1]:
wins.append(False)
else:
wins.append(True)
print("win" if wins[-1] else "lose")