##并查集部分代码
#include<bits/stdc++.h>
using namespace std;
int findFather(int x){
int a=x;
while(x!=father[x]){
x=father[x];
}
while(a!=father[a]){
int z=a; //因为a会被father[a]覆盖,所以用z存一下a的值
a=father[a];
father[z]=x;
}
return x;
}
int findFather1(int x){
if(x==father[x]) return x;
else{
int F=fatherFather1(father[x]);
father[x]=F;
return F;
}
}