Rosetta Problems

Escape from the Labyrinth

https://atcoder.jp/contests/awc0076/tasks/awc0076_d