':type words: List[str]
:rtype: List[List[str]]'

def wordSquares(self, words):

    result = []
    trie = TrieNode()
    for i in xrange(len(words)):
        trie.insert(words, i)
    curr = []
    for s in words:
        curr.append(s)
        self.wordSquaresHelper(words, trie, curr, result)
        curr.pop()
    return result
