Codeforces Beta Round 94 (Div. 1 Only)
A
Statues
Codeforces
1500
原题
←B →
翻译中…

In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard ($8 × 8$): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, the board has several statues. Each statue occupies exactly one square. A square that contains a statue cannot have anything or anyone — neither any other statues, nor Anna, nor Maria.

翻译中…

Anna is present on the board as a figurant (she stands still and never moves), and Maria has been actively involved in the game. Her goal is — to come to Anna's square. Maria and statues move in turn, Maria moves first. During one move Maria can go to any adjacent on the side or diagonal cell in which there is no statue, or she can stay in the cell where she is. The statues during their move must go one square down simultaneously, and those statues that were in the bottom row fall from the board and are no longer appeared.

翻译中…

At that moment, when one of the statues is in the cell in which the Maria is, the statues are declared winners. At the moment when Maria comes into the cell where Anna has been waiting, Maria is declared the winner.

翻译中…

Obviously, nothing depends on the statues, so it all depends on Maria. Determine who will win, if Maria does not make a strategic error.

翻译中…

Input

翻译中…

You are given the $8$ strings whose length equals $8$, describing the initial position on the board. The first line represents the top row of the board, the next one — for the second from the top, and so on, the last line represents the bottom row. Each character string matches a single cell board in the appropriate row, and the characters are in the same manner as that of the corresponding cell. If the cell is empty, the corresponding character is ".". If a cell has Maria, then it is represented by character "M". If a cell has Anna, it is represented by the character "A". If a cell has a statue, then the cell is represented by character "S".

翻译中…

It is guaranteed that the last character of the first row is always "A", the first character of the last line is always "M". The remaining characters are "." or "S".

翻译中…

Output

翻译中…

If Maria wins, print string "WIN". If the statues win, print string "LOSE".

翻译中…

样例

Input #1
.......A
........
........
........
........
........
........
M.......
Output #1
WIN
InputCopy OutputCopy
Input #2
.......A
........
........
........
........
........
SS......
M.......
Output #2
LOSE
InputCopy OutputCopy
Input #3
.......A
........
........
........
........
.S......
S.......
MS......
Output #3
LOSE
InputCopy OutputCopy
题目信息
题号
128A
时间限制
2 s
内存限制
256 MB
标签
DFS 及类似

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。