Solve maze problem using BFS