Rosetta Problems

JOI国のお散歩事情 (Walking in JOI Kingdom)

https://hoj.hamako-ths.ed.jp/onlinejudge/problems/260