python solution
\nclass Solution:\n    # @param root, a tree link node\n    # @return nothing\n    def helper(self, left, right):\n        if not left or not right:\n          
```\nclass Solution:\n    # @param root, a tree link node\n    # @return nothing\n    def helper(self, left, right):\n        if not left or not right:\n            return\n        \n        left.next = right\n        self.helper(left.right, right.left)\n        self.helper(left.left, left.right)\n        self.helper(right.left, right.right)\n    \n    def connect(self, root):\n        if not root:\n            return\n    \n        self.helper(root.left, root.right)\n\t```
[]