Consider a two-player game with *n* rectangles.
Initially, each reactangle *i* has *r*_{i} rows and *c*_{i} columns.
Alternating moves, each player chooses any rectangle *i*
(that has not been fully removed yet),
and removes the top row or the left column from it,
thus reducing the size to either (*r*_{i} − 1) × *c*_{i}
or *r*_{i} × (*c*_{i} − 1), respectively.
The player that eventually cannot make any move loses the game.

Please write a program that tells if, with perfect play, the first player can win a given game.

**Input**

Input consists of several cases.
Every case begins with the number of rectangles *n*,
followed by *n* pairs of integer numbers *r*_{i} and *c*_{i}.
Assume 1 ≤ *n* ≤ 10^{5}
and 1 ≤ *r*_{i}, *c*_{i} ≤ 10^{9}.

**Output**

For every case, print “`wins`” or “`loses`”.

Public test cases

**Input**

1 1 5 1 2 2 1 5 9 1 5 4 2 1 5 5 4 2 1 6 5 4 3 1000000000 1 999999999 2 999999996 999999998

**Output**

wins loses loses wins loses wins loses

Information

- Author
- Salvador Roura
- Language
- English
- Official solutions
- C++
- User solutions
- C++