#include using namespace std; using ll=long long; int main(){ ll n,m; cin>>n>>m; vector c(n); for(ll i=0;i>c[i]; c[i]--; } vector> G(n); for(ll i=0;i>u>>v; u--; v--; if(c[u]==c[v]){ G[u].push_back(v); G[v].push_back(u); } } vector seen(n,false); queue que; vector> vec; ll id=0; for(ll i=0;i cnt(n,0); for(ll i=0;i