Problem

You decide to play a weird game with your friend A, who loves gathering.

Given a set S of non-negative integers consisting of n elements that can be duplicated. Each element contained in the set S is a non-negative pi-ary number. With Steps 1 to 3 below as one turn for the set S, you and your opponent repeat the turn alternately. In each turn, operate in the order of this number.

Step 1: Remove all the elements contained in the set S once, convert each removed element to a binary number, erase 0, divide it into one or more consecutive 1s, and divide the divided part. Add all to set S.

Step 2: If Set S is empty at this time, the player currently playing this turn loses.
Step 3: Select one element a contained in the set S, and subtract any integer x that satisfies 1 ≤ x ≤ a from that a.


The figure below is an example of how to proceed for the first turn given the following inputs.


Four
10 3
2 11
16 5
16 AE


<image>


The first is your turn. When both parties do their best for a given input, do you really win?



Input

The input is given in the following format:


n
p1 m1
p2 m2
...
pi mi
...
pn mn


N pi-ary numbers mi, which are elements of the set, are given. The number n of elements in the set does not exceed 105. Also, 2 ≤ pi ≤ 62 is satisfied. The pi-ary number mi uses 52 letters of the alphabet in addition to the usual numbers 0-9. The order is 012 ... 789 ABC ... XYZabc ... xyz in ascending order, and the characters up to the i-th are used. Also, the pi-ary mi does not exceed 218-1 in decimal.

Output

Output win if you win against the given input, lose if you lose.

Examples

Input

1
10 1


Output

win


Input

2
10 1
10 1


Output

lose


Input

3
25 53AI
43 3BI0
62 pn6


Output

win
#include<iostream>
#include<string>
using namespace std;
char C[63] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
int convert(int p, string S) {
	int power[20]; power[0] = 1; for (int i = 1; i <= S.size(); i++)power[i] = power[i - 1] * p;
	int cnt = 0;
	for (int i = 0; i < S.size(); i++) {
		for (int j = 0; j < p; j++) {
			if (C[j] != S[i])continue;
			cnt += power[S.size() - 1 - i] * j;
		}
	}
	return cnt;
}
int main() {
	int n; cin >> n; int W = 0;
	for (int i = 0; i < n; i++) {
		string U; int a; cin >> a >> U; a = convert(a, U);
		W ^= a;
	}
	if (W == 0)cout << "lose" << endl;
	else cout << "win" << endl;
	return 0;
}