re-implement disjoint set forest