disjoint_set update, FOREACH update