Dfs Algorithm Geeksforgeeks Python Problem