Add disjoint-set data structure.