codeforces#P92112. Labyrinth-12

Labyrinth-12

Description

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