class Node:
def __init__(self) -> None:
# Note that using a dictionary for children (as in this implementation)
# would not by default lexicographically sort the children, which is
# required by the lexicographic sorting in the Sorting section.
# For lexicographic sorting, we can instead use an array of Nodes.
self.children: Dict[str, Node] = {} # mapping from character to Node
self.value: Optional[Any] = None