[Python] Clean Iterative & Recursive DFS
Iterative DFS\n\nclass Solution:\n    def flipEquiv(self, root1: TreeNode, root2: TreeNode) -> bool:\n        queue = deque([(root1, root2)])\n        while que
### Iterative DFS\n```\nclass Solution:\n    def flipEquiv(self, root1: TreeNode, root2: TreeNode) -> bool:\n        queue = deque([(root1, root2)])\n        while queue:\n            node1, node2 = queue.pop()\n            if (not node1) and (not node2):\n                continue\n            elif (not node1) or (not node2) or (node1.val != node2.val):\n                return False\n            L1, R1, L2, R2 = node1.left, node1.right, node2.left, node2.right\n            if (L1 and L2 and L1.val == L2.val) or (R1 and R2 and R1.val == R2.val):\n                queue.append((L1, L2))\n                queue.append((R1, R2))\n            else:\n                queue.append((L1, R2))\n                queue.append((L2, R1))\n        return True\n```\n### Recursive DFS\n```\nclass Solution:\n    def flipEquiv(self, root1: TreeNode, root2: TreeNode) -> bool:\n        def dfs(node1 = root1, node2 = root2):\n            if (not node1) and (not node2):\n                return True\n            elif (not node1) or (not node2) or (node1.val != node2.val):\n                return False\n            L1, R1, L2, R2 = node1.left, node1.right, node2.left, node2.right\n            if (L1 and L2 and L1.val == L2.val) or (R1 and R2 and R1.val == R2.val):\n                return dfs(L1, L2) and dfs(R1, R2)\n            else:\n                return dfs(L1, R2) and dfs(L2, R1)\n        return dfs()\n```
['Depth-First Search', 'Recursion', 'Iterator', 'Python', 'Python3']