Elegant Iterative Solution
\nclass Solution:\n    def traverseChild(self, head):\n        tail = head\n        while tail and tail.next:\n            tail = tail.next\n        return tail
```\nclass Solution:\n    def traverseChild(self, head):\n        tail = head\n        while tail and tail.next:\n            tail = tail.next\n        return tail\n    \n    def flatten(self, head: \'Node\') -> \'Node\':\n        curr = head\n        while curr:\n            if curr.child:\n                tail = self.traverseChild(curr.child)\n                tail.next = curr.next\n                if tail.next:\n                    tail.next.prev = tail\n                curr.next = curr.child\n                curr.child.prev = curr\n                curr.child = None   \n            curr = curr.next\n        return head\n\t\t\n```\n\n# Explanation\n1. Flatten function traverses linked list to find any nodes with a child node.\n2. Once it finds a node with a child node it calls traverseChild on the child node\n3. TraverseChild returns tail of the child LinkedList\n4. Now it is a simple linked list insertion in a doubly linked list\n\t* \tprevious of curr node\'s next (`curr.next.prev`) becomes tail node and\n\t* \tchild node becomes curr node\'s next
['Iterator', 'Python', 'Python3']