Implement the serialization of "*naiveTrie".