#P3854. [TJOI2008] 通讯网破坏
[TJOI2008] 通讯网破坏
Description
The leaders of country have proposed many strategies. As the chief computer scientist of country , your task is to write a program to determine whether each strategy is feasible.
Input Format
The first line contains two integers and , representing the number of cities in country and the number of pairs of cities that can communicate directly. The next lines each contain two integers and , and , indicating that cities and can communicate directly. It is guaranteed that each pair appears at most once.
The next line contains an integer , representing the number of strategies proposed by the leaders of country . The next lines each contain three integers (, and are pairwise distinct), indicating that this strategy attempts to sever communication between and by destroying .
Output Format
Output lines, each indicating whether the corresponding strategy is feasible. If, after destroying , and cannot communicate, then the strategy is feasible and you should output on the -th line; otherwise, output .
5 6
1 2
1 3
2 3
3 4
3 5
4 5
3
1 5 3
1 5 4
4 5 3
yes
no
no
Hint
For of the testdata, .
For of the testdata, $1 \leq N \leq 20000,1\leq M\leq 100000,1 \leq Q \leq 100000$.
It is guaranteed that the original graph is connected.
Translated by ChatGPT 5
京公网安备 11011102002149号