#include #include #include #include #include using namespace std; const int N = 100500; int fa[N],tot[N]; int n; int getint() { int res=0; char ch=getchar(); while((ch<'0' || ch>'9') && ch!='-') ch=getchar(); bool fan=0; if(ch=='-') { fan=1; ch=getchar(); } while('0'<=ch && ch<='9') { res=res*10+ch-'0'; ch=getchar(); } if(fan) res=-res; return res; } int getf(int x) { if(fa[x]!=x) fa[x]=getf(fa[x]); return fa[x]; } void f() { int i; n=getint(); for(i=1;i<=n;i++) { fa[i]=i; tot[i]=1; } for(i=1;i