Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register
Language:
Cubic Tick-Tack-Toe
 Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 956 Accepted: 117

Description

Tick-Tack-Toe is a famous simple game that is played on 3*3 grids. Two players put stones in the grids alternately and each one has his own color of stones that differ from the opponent's. The player that first gets a line of three stones vertically, horizontally, or diagonally wins the game. If the grids are all filled and no one makes a line of tree stones, the game is called a draw.

Sram Eel loves playing Tick-Tack-Toe very much. He plays it with his friend Tzxhsw every day. However, because of his weak skills, he always loses the game. Recently, he finally angers and decides to change the game to make it more interesting, that is, Cubic Tick-Tack-Toe!

Cubic Tick-Tack-Toe is played in 3*3*3 grids. Players put stones in the grids from bottom to top alternately, i.e. a stone cannot be putted in a grid, which is upon an empty grid. A player can win the game through getting one of the 49 lines of three stones. Tzxhsw is not so skilled in such a strange game, so she requests your help. To show your pure virtue, please put up your hands and knock on your keyboard!

Input

The input contains multiple test cases. Each test case contains 9 lines describing the current grids. A '.' denotes an empty grid, a 'O' denotes a stone put by the player taking the first turn, and a 'X' denotes a stone put by another player. The grids are described from bottom to top. Your program should estimate which player takes the next turn and analyze whether he can win the game or not.

Output

There is only one line for each test case. If the player taking the next turn can manage to win the game, print "WIN". If he will lose, print "LOSE". If the game will become a draw, print "DRAW".

Sample Input

```OXX
..O
...
XO.
...
...
OX.
...
...

OX.
...
..O
XO.
...
...
OX.
...
...
```

Sample Output

```WIN
LOSE
```

Source

POJ Monthly,CHEN Shixi(xreborner)

[Submit]   [Go Back]   [Status]   [Discuss]