added disjoint set data structure