#include using namespace std; using ll=long long; constexpr ll mod=1000000007; struct UnionFind{ int N; vector par; vector ans; UnionFind(int n):N(n),par(n,-1),ans(n,1){} int find(int x){ return par[x]<0 ? x : par[x]=find(par[x]); } void unite(int x,int y){ x=find(x); y=find(y); if(x==y)return; if(par[x]>par[y]) swap(x,y); if(par[x]==par[y]){ for(int i=0;i>N>>M; UnionFind UF(N); for(int i=0;i>A>>B; UF.unite(A-1, B-1); } for(int i=0;i