#include<bits/stdc++.h> using namespace std; const int N=100010,M=400010; int h[N],e[M],ne[M],idx; int din[N]; int dout[N]; bool st[M]; int cnt; int type; int ans[M]; int p[N]; void add(int a,int b) { e[idx]=b,ne[idx]=h[a],h[a]=idx++; } void dfs(int u) { //cout<<u<<endl; for(int &a...