Trie construction