We have seen in class that this problem 22-3 is nothing but DFS and the sets correspond to nodes at the ``active path.'' Each set are all the nodes reachable from the node on the active path, going thru backtracked nodes. When we have a pair and we backtrack from the second node, the least common ancestor is on the active path and is the root of the set holding the first node.