| 121 | ios_base::sync_with_stdio(false); |
| 122 | cin.tie(NULL); |
| 123 | tc(T) |
| 124 | { |
| 125 | int n,r; |
| 126 | cin>>n>>r; |
| 127 | vector<ii> edges(r+2); |
| 128 | for (int i = 0; i < r; ++i) |
| 129 | { |
| 130 | int x,y; |
| 131 | cin>>x>>y; |
| 132 | edges[i]={x,y}; |
| 133 | } |
| 134 | int src,sink,k; |
| 135 | cin>>src>>sink>>k; |
| 136 | Dinic dc(n+2,src,sink); |
| 137 | for(int i=0;i<r;i++) |
| 138 | { |
| 139 | dc.add_edge(edges[i].ff,edges[i].ss,1); |
| 140 | } |
| 141 | if((k+1)<=dc.flow()) |
| 142 | { |
| 143 | cout<<"YES\n"; |
| 144 | } |
| 145 | else cout<<"NO\n"; |
| 146 | } |
| 147 | return 0; |
| 148 | } |