#include #include using namespace std; const int maxn=1100000,maxm=4*maxn; struct Edge { int y; int ne; } e[maxm]; int st[maxn],ee; void addedge(int x,int y) { e[ee].y=y;e[ee].ne=st[x];st[x]=ee++; e[ee].y=x;e[ee].ne=st[y];st[y]=ee++; } int c[maxn]; int numn[maxn],numm[maxn],lost[maxn]; int s[maxn],head,tail; void bfs(int k,int col) { int i; head=0;tail=1;s[0]=k; c[k]=col; while (headnumm[c[i]]) if (lost[c[i]]