#include #define N 100005 using namespace std; int n,k; int hv[N]; int head[N],id; struct edge{ int to,nxt; }E[N]; inline void add_edge(int a,int b){ E[++id]=(edge){b,head[a]}; head[a]=id; } inline void Rd(int &res){ char c;res=0; while(c=getchar(),c<48); do res=(res<<3)+(res<<1)+(c^48); while(c=getchar(),c>47); return; } int mx[N],mst[N]; void dfs(int x){ if(hv[x])mx[x]=0,mst[x]=1; else mx[x]=-1e9; for(int i=head[x];i;i=E[i].nxt){ int v=E[i].to; dfs(v); if(mx[v]