Basic implementation of UnionFind::Union, UnionFind::IsConnected