Rosetta Problems

Teleporting Takahashi

https://atcoder.jp/contests/abc240/tasks/abc240_g