Disjoint set data structure