Messy Kevin VI
With no more job, Kevin has a lot of free time. He could start searching for jobs, but he wants to relax for a bit. Since he was always in the office trying to fix his mess-ups, he hasn't gone outside in a while and for once, missed touching grass.
He goes outside to the local park and wants to walk across it from one side to the other, which we can represent as an $n \times m$ grid. He starts at the top-left of the grid and tries to get to the bottom-right, being able to move left, right, up, and down. However, there are patches of mud and dirt which he wants to avoid, because it would get his shoes all dirty. Can you help Kevin cross the park without messing his shoes?
Input
The first line contains two integers, and
, the height and width of the park.
The next lines contain
characters. An asterisk
*
represents an obstacle, while .
represents a patch of grass that Kevin can walk on.
Output
Output "SUCCESS" if Kevin is able to cross the park while avoiding obstacles. If not, output "FAIL".
Example
Input 1
3 4
.*..
..**
*...
Output 1
SUCCESS
Input 2
3 4
.*..
.***
*...
Output 2
FAIL
Comments