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