1 #include2 3 using namespace std; 4 5 int max(int x,int y){ 6 if(x>y)return x;else return y; 7 } 8 9 int find(int);10 11 int n,m,f,x,y,a,b;12 int fa[10005],h[10005];13 14 int main(){15 scanf("%d%d",&n,&m);16 for(int i=1;i<=n;i++){17 fa[i]=i;18 h[i]=1;19 }20 for(int i=1;i<=m;i++){21 scanf("%d%d%d",&f,&x,&y);22 a=find(x);23 b=find(y);24 if(f==1){25 if(h[a]