#t349. 取石子游戏

取石子游戏

The Stone-Taking Game

Problem Background

Special for beginners, ^_^

Problem Description

There are two piles of stones, and two players take turns. In each move, you may only take stones from the larger pile, and the number taken must be an integer multiple of the number of stones in the smaller pile. Whoever empties a pile first wins.

For example, initially the two piles contain 25 and 7 stones.

25 7  -->  11 7 -->  4 7  -->  4 3  -->  1 3  -->  1 0
    player 1 takes    player 2 takes     player 1 takes     player 2 takes     player 1 takes

Finally player 1 (who moves first) wins; during the process player 2 always had exactly one way to move.

Given the initial numbers of stones, if both players play optimally, determine whether the first player can win.

Input Format

The input contains multiple data sets. Each data set is one line containing two positive integers aa and bb, the initial numbers of stones. The input ends with two zeros.

Output Format

If the first player wins, output win; otherwise output lose.

Sample Input

34 12
15 24
0 0

Sample Output

win
lose

Hint

Suppose the stone counts are (a,b)(a,b) with a≥ba \ge b. If [a/b]≥2[a/b] \ge 2 then the first player wins; otherwise the first player has exactly one way to move.

[a/b][a/b] denotes the integer part (floor) of aa divided by bb.

Constraints

Time limit: 1s, memory limit: 1024KiB for each test case.