By Unknown Brazil
A group of crazy scientists from PSGA (Pindamonhangaba's Science and Gymnastics Academy) is studying the behavior of an odd spiecies of blind ants. After years of research, they concluded that:
In order to prove these conclusions, the scientists built a series of sceneries to test the ants. Each scenery consists of a rectangle with dimensions of M x N meters. Each scenery has four entries, located on each of the vertices, that from now on shall be called by one of the cardinal points, as follows:
Inside the rectangle, MN amounts of food were distributed in the center of each of the 1m x 1m squares contained in the scenery. The ants are inserted into each scenery through one of the four possible entries in a path that makes a 45 degrees angle with both sides of the rectangle conected in that vertex. After walking aproximately 0.707m an ant encounters its first meal and continues following a straight line after eating it until one of the following happens:
Your mission is to write a program that predicts what's going to happen with the testing ant in each of the sceneries.
The input/output should be written in portuguese. North = Norte, South = Sul, Oeste = West, Leste = East.
The input consists of a series of sceneries. For each scenery will be provided, in one line, the measurements of the rectangle, first the width M (North - West) and then the height N (North - East) (0 < m,n ≤ 100.000), the door though which the ant was inserted. A line containing a value of 0 for one of the rectangle's dimensions signals the end of the input.
For each scenery, you'll have to write one line on the output file, with one of the following contents:
The following image is related to the sample input/output:
|Sample Input||Sample Output|
1 1 Norte
4 8 Norte
3 2 Sul
100000 100000 Oeste
100000 0 AnythingHereIsValid
100% 0 Sul
25% 1 Leste
100% 3 Oeste
0% 0 Leste