#include #include #include #include #define INF 0x7ffffff #define mm(x) memset(x,0,sizeof(x)) using namespace std; const int N=50000+9; const int M=100000+9; stacks; struct node { int to,next; int w; }G[M]; struct edge { int u,v,w; }NG[M]; int indegree[N]; int instack[N],paint[N],col,index,dfn[N],low[N]; int head[N],cnt,Ncnt; class tarjan { public: int MIN(int a,int b) { if(a