UnionFind class with methods for finding the representative of a set, performing union operations, and checking if the graph is fully connected.UnionFind, one for Alice and one for Bob.edgesRequired to 0.UnionFind instances. Increment edgesRequired if the edge connects previously disconnected components.edgesRequired for each necessary edge.edgesRequired. Otherwise, return -1.