Implement trie tree