implementing quick union