implement trie