Solving mazes on the Python