[K8] Kattis: BFS problem II (2 pts) [00MT]

Solve another one of the problems from [K7] Kattis: BFS problem I (2 pts).