/* [NWERC'09] Room assignments by: Jan Kuipers */ #include #include #include using namespace std; int N,V,E; vector > c; vector u; void go (int n, int mark) { if (u[n]) return; u[n]=mark; V++; for (int i=0; i>runs; while (runs--) { cin>>N; c=vector >(N); for (int i=0; i>a>>b; a--; b--; c[a].push_back(b); c[b].push_back(a); } vector v(N); for (int i=0; i>v[i]; u=vector(N,0); int ncc=0, ntree=0, tree=-1; for (int i=0; i1) { cout<<"impossible"< > vv; for (int i=0; i1 ? vv[1].second : -1; bool samev = vv.size()>1 && vv[0].first==vv[1].first; for (int i=0; ib) swap(a,b); cout<