Implement trie