Rosetta Problems

Secret Passage

https://atcoder.jp/contests/agc046/tasks/agc046_d