Disjoint-set Data Structure.