CF BUDDY
← Problems·

1383B · GameGame

1900 · bitmasks, constructive algorithms, dp

Problem: Koa the Koala and her best friend want to play a game.

The game starts with an array aa of length nn consisting of non-negative integers. Koa and her best friend move in turns and each have initially a score equal to 00. Koa starts.

Let's describe a move in the game:

  • During his move, a player chooses any element of the array and removes it from this array, xor-ing it with the current score of the player. More formally: if the current score of the player is xx and the chosen element is yy, his new score will be xyx \oplus y. Here \oplus denotes bitwise XOR operation. Note that after a move element yy is removed from aa.
  • The game ends when the array is empty.

At the end of the game the winner is the player with the maximum score. If both players have the same score then it's a draw.

If both players play optimally find out whether Koa will win, lose or draw the game.

Input Format: Each test contains multiple test cases. The first line contains tt (1t1041 \le t \le 10^4) — the number of test cases. Description of the test cases follows.

The first line of each test case contains the integer nn (1n1051 \le n \le 10^5) — the length of aa.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (0ai1090 \le a_i \le 10^9) — elements of aa.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5.

Output Format: For each test case print:

  • WIN if Koa will win the game.
  • LOSE if Koa will lose the game.
  • DRAW if the game ends in a draw.

Note: In testcase 11 of the first sample we have:

a=[1,2,2]a = [1, 2, 2]. Here Koa chooses 11, other player has to choose 22, Koa chooses another 22. Score for Koa is 12=31 \oplus 2 = 3 and score for other player is 22 so Koa wins.

Sample Cases

Case 1

Input

3
3
1 2 2
3
2 2 3
5
0 0 0 2 2

Output

WIN
LOSE
DRAW

Case 2

Input

4
5
4 1 5 1 3
4
1 0 1 6
1
0
2
5 4

Output

WIN
WIN
DRAW
WIN

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback