Depth First Search to walk out of a 2D maze.
Remove redundant lines