Jsumabat is looking for his only friend in the cafeteria. Looking around, realizes that some of his field of view is blocked by tables because he is very short. Given the layout of the cafeteria, determine is can see his only friend if he were to look in the 4 cardinal directions.
is a student at Thornhill Secondary School. He only has 1 friend and that friend is who also goes to the school. During their lunch break,Input Specification
The first line of input contains representing the dimensions of the square shaped cafeteria.
The next lines of input each contain characters representing a row in the cafeteria. a .
character represents empty space that can see through. A |
character represents a table that obscures his field of view. A j
represents 's location and r
represents the location of his only friend. It is guaranteed that there will be 1 occurrence of j
and 1 occurrence of r
. It is guaranteed that r
will be directly in one of the 4 cardinal directions of j
.
Output Specification
Print YES
if can see his only friend and ALL ALONE
if he can not.
Sample Input
5
.r...
.|...
.....
.j...
..||.
Sample Output
ALL ALONE
Comments