#include #include using namespace std; int par(int x,vector& p) { if(x == p[x])return x; else return p[x] = par(p[x],p); } long long gcd(long long a,long long b) { if(b)return gcd(b,a%b); else return a; } int main() { int N,M,t; cin >> N >> M; vector p(N); for(int i=0;i> t; vector s(t),pp = p; for(int j=0;j> s[j]; for(int j=0;j pa(N),c(N,0); for(int i=0;i