Rosetta Problems

Switching Railroad Cars

https://onlinejudge.u-aizu.ac.jp/problems/0013