spoj#SNGGW. Great Warrior

Great Warrior

当前没有测试数据。

This problem is about an imaginary game. First of all, define a War Board that is a N x N square matrix. Each matrix cell represents a warrior and the value written in the cell is the power of that particular warrior.

Rules for assigning powers of each warrior

1. First start filling the main diagonal with numbers 1, 2, 3, 4 .... K according to requirement. Starting of filling always be at the top corner.
2. Now start filling the anti diagonal with numbers k + 1, k + 2, k + 3, k + 4 .... L according to requirement. Starting of filling always be at the bottom corner. Don't forget that in case of filling the anti diagonal if there is any number already filled it will be modified by the current number that is to be filled, if that particular cell was empty.
3. Now fill all the empty cells, in anti-clockwise spiral filling manner. The first cell to be filled will be 2nd last column of first row.

5 x 5 War Board

Image to describe power assignment to each cell

Description of game
The greatest warrior W of king Pushyamitra Shunga is having fight with Yavana warriors. W fights with one Yavana warrior Y at a time. Consider the followings
1. Power_of_W is more than Yavanas.
2. W can defeat Y if Power_of_W > Power_of_Y - 1
3. After each win Power_of_W decreases by Power_of_Y
4. W can move to cells adjacent to it. If Current_Cell_Location_of_W is (i, j) then
Next_Cell_Location_of_W will be one of (i ± 1, j ± 1) or (i ± 1, j) or (i, j ± 1)
5. W will win if W defeats Y such that Power_of_Y = 1, otherwise W is defeated.

What to code
You have to code to verify whether W wins or get defeated but don't forget the followings -
1. The one cell location is of W and other cell locations are of Yavanas
2. Its up to W to choose the Yavana warrior Y to fight with
3. Its not necessary that W has to defeat all Yavanas, W just want to win

[All the information required to solve this problem is provided in the description]

Input

First line of input is t, total number of test cases (t < 1001). Next t lines contains value of
N (2 < N < 1000).

Output

Output for each test case is single line printing either DWON Final_Power_of_W (If W wins) or DDOWN (If W is defeated).

Example

Input:
1
5

Output: DWON 15

</p>