유파 할때 union by rank 하는데 이것보다

int find(int n){

if(par[n]==n) return n;

return par[n]=find(par[n]);

}

해서 바로바로 올리는게 낫지 않음?