#include <stdio.h>
#include <stdlib.h>
int xiangsi[10000000];
int chaoxi[10000000];
int tuanhuo[10000000];
int n,m;
int find1(int x){
if(x!=xiangsi[x])xiangsi[x]=find1(xiangsi[x]);
return xiangsi[x];
}
int find2(int x){
if(x!=chaoxi[x])chaoxi[x]=find2(ch...