void setParentPointers(Node node, [Node? parent]) { node.parent = parent; node.forEach((child) => setParentPointers(child, node)); }