Use queue to implement BFS, pair, maze-like problem.