Pankaj: Add implicit implementation of TernaryTrie. Looks pretty bad wrt heap.