Union Find base and Quick Find implementation.