OpenKattis
Onlinekvalet 2018

#### Start

2017-11-15 10:00 CET

## Onlinekvalet 2018

#### End

2017-12-03 21:00 CET
The end is near!
Contest is over.
Not yet started.
Contest is starting in -1682 days 19:32:12

443:00:00

0:00:00

# Problem ATreasure Map

Paulina really likes Japan, a lot. During a vacation in Tokyo, she visited an amusement park with a huge labyrinth. To navigate in the labyrinth, Paulina got a treasure map that she follows. On the treasure map, each square in the labyrinth is marked with an arrow to show you what way to walk from that square.

Paulina always starts in the square that is in the top left of the map, and follows the arrows from there. In the labyrinth, there are two different goals: a yummy piece of salmon sushi, or a scary samurai. It can also be the case that the treasure map will lead Paulina around in an infinite cycle of squares, so that she never reaches one of the goals.

Can you help Paulina read the treasure map to tell her which goal she arrives, or if she will walk around in a cycle for all eternity?

## Input

The input starts with a line containing the number of rows $R$ ($1 \le R \le 100$) in the map. The next line contains the number of columns $C$ ($1 \le C \le 100$) in the map. Finally, this is followed by $R$ lines each containing $C$ characters each, the treasure map itself.

The following characters may appear in the map:

• <” – a square with an arrow pointing left.

• >” – a square with an arrow pointing right.

• v” – a square with an arrow pointing down.

• ” – a square with an arrow pointing up.

• A” – the square where the sushi is.

• B” – the square where the samurai is.

Paulina will start on the leftmost square in the first row of the map. The map is constructed so that Paulina will never exit the labyrinth by following the arrows.

## Output

Your program should output a single line with word

• sushi” if she reaches the sushi.

• samuraj” if she reaches the samurai.

• cykel” if she will run aronud forever by following the arrows.

## Scoring

Your solution will be tested on a number of test groups. To get the points for a group, you must pass all the cases in the group.

 Group Points Limits 1 40 There is only one case, the one from this image. 2 30 Paulina will always reach either the sushi or the samurai, never a cycle. 3 30 No additional constraints.
Sample Input 1 Sample Output 1
3
3
vB<
vA^
>>^

samuraj

Sample Input 2 Sample Output 2
4
4
v>>v
>^Av
vv^v
B<^<

sushi

Sample Input 3 Sample Output 3
3
3
v<A
>^B
>>^

cykel