codeforces#P92106. Labyrinth-6

Labyrinth-6

Description

See the problem statement here: http://codeforces.com/contest/921/problem/01.