Quintiq Puzzle Competition Week #4

#### Start

2018-05-07 08:00 UTC

## Quintiq Puzzle Competition Week #4

#### End

2018-05-14 08:00 UTC
The end is near!
Contest is over.
Not yet started.
Contest is starting in -317 days 17:49:09

168:00:00

0:00:00

# Problem ABlock Game

You are attending the International Construction by Preschoolers Contest. Unfortunately, you are too old to participate, but you still enjoy watching the competition.

In between rounds, you are walking around the contest area when you see a toddler, one of the contestants, playing with her blocks. Annoyed that she is having all the fun, you decide to challenge her to a game.

You set up two stacks of blocks of a certain height. Then, you and the toddler take turns removing some number of blocks from the stack which contains the largest number of blocks (if both stacks have the same number of blocks, the current player can choose either stack to remove blocks from). The number of blocks removed must be a positive multiple of the number of blocks in the smaller stack. For instance, if there is a stack with $5$ blocks, and one with $23$ blocks, then the current player can remove $5$, $10$, $15$ or $20$ blocks from the stack of $23$ blocks. The player who empties one of the stacks wins the game.

You have graciously decided to take the first move, but then a worry strikes you – might this devious preschooler still be able to beat you?

## Input

One line with two integers $N$ and $M$, satisfying $1 \leq N, M\leq 10^{18}$, the initial sizes of the two stacks of blocks.

## Output

Output a single line containing a single word: the word “win” if you are guaranteed to win if you play correctly, and the word “lose” if your opponent can force you to lose.

Sample Input 1 Sample Output 1
3 2

lose

Sample Input 2 Sample Output 2
3 3

win

Sample Input 3 Sample Output 3
5 2

win

Sample Input 4 Sample Output 4
5 3

win

Sample Input 5 Sample Output 5
13 10

lose