def dfs(i,j,path): if i+1 < m and maze[i+1][j] == 0 and ((i+1,j) not in path ): dfs(i+1,j,path+[(i+1,j)]) if i-1 >= 0 and maze[i-1][j] == 0 and ((i-1,j) not in path): dfs(i-1,j,path+ [(i-1,j)]) if j-1 >= 0 and maze[i][j-1] == 0 and ((i,j-1) not in path): ...