#include using namespace std; typedef long long ll; class UF { private: vector par,c; public: UF(int n) { for (int i=0;i>n>>m; UF uf(n); while (m--) { int a,b; cin>>a>>b; a--,b--; int x=uf.find(a); int y=uf.find(b); if (x==y) continue; if (uf.cnt(x)>uf.cnt(y)) uf.unite(x,y); else if (uf.cnt(x)