#include using namespace std; struct UnionFind{ vector data; UnionFind(int size) : data(size, -1) { } bool unite(int x,int y){ x=root(x);y=root(y); if(x!=y){ if(data[y]>n; int m; cin>>m; UnionFind uf(n+1); for(int i=0;i>a>>b; uf.unite(a,b); } for(int i=1;i<=n;i++){ cout<