Quick find UnionFind implementation