Simple implementation of trie and hash