405998: GYM102215 D Country Division
Description
A country has $$$n$$$ cities that are connected by $$$(n-1)$$$ roads, and it is possible to reach every city from every other city. Before the election political analysts have made $$$q$$$ predictions how the election will proceed. In each of these predictions it is supposed that some cities will support one candidate (we will call such cities red), some other cities will support another candidate (we will call such cities blue), and the citizens in the remaining cities don't care about politics and they don't support anyone.
For every prediction you have to answer, is it possible or not to block some roads so that from every red city it is possible to reach every other red city, from every blue city it is possible to reach every other blue city, but from every red city it is not possible to reach every blue city.
InputThe first line contains an integer $$$n$$$ ($$$2 \le n \le 200000$$$) — the number of cities.
Each of the next $$$(n-1)$$$ lines contains two integers $$$u_i, v_i$$$ ($$$1 \le u_i, v_i \le n$$$) — the numbers of cities connected by roads.
The next line contains an integer $$$q$$$ ($$$1 \le n \le 200000$$$) — the number of predictions.
Each of the next $$$q$$$ lines contains a description of the prediction. It starts with two integers $$$r_j$$$ and $$$b_j$$$ ($$$1 \le r_j, b_j < n, r_j + b_j \le n$$$) — how many red and blue cities this prediction has. Then $$$r_j$$$ integers follow — the numbers of red cities. Then $$$b_j$$$ integers follow — the numbers of blue cities. All cities in each prediction are distinct.
The sum of all $$$r_j$$$ and $$$b_j$$$ over all predictions doesn't exceed $$$200000$$$.
OutputFor every prediction, output the answer for it — «YES» or «NO» — in a separate line.
ExampleInput7 1 2 1 3 2 4 2 5 3 6 3 7 6 2 2 4 5 6 7 2 2 4 6 5 7 2 1 4 5 2 2 1 4 5 1 1 1 1 2 6 1 1 2 3 4 5 6 7Output
YES NO NO YES YES YES