build a trie