remove duplicate UnionFind implementation