adding UnionFind interface