MazeSolver Algorithm using Queues