Python Trie + DFS (No extensive loops or complicated TrieNode)
\nclass TrieNode:\n    def __init__(self):\n        self.children = {}\n        self.end = False\n        \nclass Trie:\n    def __init__(self):\n        self.r
```\nclass TrieNode:\n    def __init__(self):\n        self.children = {}\n        self.end = False\n        \nclass Trie:\n    def __init__(self):\n        self.root = TrieNode()\n    \n    def insert(self, word):\n        cur = self.root\n        for c in word:\n            if c not in cur.children:\n                cur.children[c] = TrieNode()\n            cur = cur.children[c]\n        cur.end = True\n    \n    def longest_word(self):\n        def helper(node, partial_res):\n            res = partial_res\n            for c, child in node.children.items():\n                if child.end:\n                    pot = helper(child, partial_res + c)\n                    if len(pot) > len(res):\n                        res = pot\n                    elif len(pot) == len(res) and pot < res:\n                        res = pot\n            return res\n        return helper(self.root, \'\')\n\nclass Solution:\n    def longestWord(self, words):\n        """\n        :type words: List[str]\n        :rtype: str\n        """\n        T = Trie()\n        for word in words:\n            T.insert(word)\n        return T.longest_word()\n```
[]