cut_trie improved to save time.