Inner implementation of quick union.