﻿ Fuzhou University OnlineJudge ﻿
Problem 1815 Robots

## Problem Description

Robots is a game played on an mn board in which you must try to survive for as long as possible as a number of robots try to kill you. The robots can move one square horizontally, vertically, or diagonally at a time. Each robot moves one step at a time (and all move simultaneously), taking the shortest path to your position. The robots will always move diagonally first, until they have a straight path (either horizontal or vertical) towards you. If two robots move to the same square at the same time, they crash, leaving wreckage behind at the square which they crashed. If other robots then move onto the square with wreckage, they also crash into it and become wreckage. If a robot moves onto your square, you lose. If there are no robots left and you are still alive, you win. You will be given a board description and asked to determine whether it is a winning or losing position.

## Input

The first line of input will contain a single integer T ≤ 10 giving the number of test cases to follow. Each test case begins with a line consisting of two white space separated integers m and n giving the dimensions of the board. These will be at most 100. The next m lines will describe the m rows of the board. Empty squares on the board will be denoted by a space, robots will be denoted by the letter R and your position will be denoted by a Y. There will be only one Y.

## Output

For each test case, you are to output either the word WIN or the word LOSE on a single line.

## Sample Input

2 2 2 RR Y 3 3 RR Y

LOSE WIN

## Source

2008-2009 North-America North-East Preliminary

Submit  Back  Status  Discuss
﻿