implements QuickFindUF and QuickUnionUF.