Trie implementation for programming challenge.