graph g; #define MAXN 100001 int gr[MAXN]; char vis[MAXN]; void f1(int i,int p,int r){ if(gr[i]){ wt("Yes"); exit(0); } gr[i]=r; rep[g.edge[i]](j,g.es[i]){ if(j!=p){ f1(j,i,r); } } } void f2(int i){ if(vis[i]){ if(vis[i]==1){ wt("Yes"); exit(0); } }else{ vis[i]=1; rep[g.edge[i]](j,g.es[i]){ f2(j); } vis[i]=2; } } int a[2d5],b[2d5],c[2d5]; { int @n,@m; rd((a,b,c)(m)); sortA(m,c,a,b); int h=2m-sum(c(m)); g.setEdge(n+1,h,a,b); int r=1; for(int i=1;i<=n;++i){ if(!gr[i]){ f1(i,0,r++); } } for(int j=h;j