AOJ 1290 - Traveling Cube

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1290

POJ 3945 - Traveling Cube と同じ.