#P7833. Animism
Animism
Animism
Problem Description
Notice:Don't output extra spaces at the end of one line. Koishi loves Subterranean Animism(SA). The map of SA is a undirected tree with nodes and roads. Koishi loves wander around SA by Rin's corpse cart. The cart use nuclear power. It take point power to pass one road. Koishi has wandering plan, in the -th plan Koishi wants to wander from to , and the cart has points of power initially. Obviously, in some plans, Koishi can't arrive the destination. To avoid this, Koishi asks Utsuho to set some nuclear-power filling station. There are such stations. The -th of them is located in the node and the level of this station is . When Koishi arrive node , she can add points of power to her cart or do nothing. Here represents the amount of power the cart has currently. For each plan, Koishi wants to know whether this plan can be finished successfully. Notice that she can pass the same road many times.
Input
The first line contains of a positive integer , representing test cases. in each test case, the first line contains three positive integers ,representing the number of nodes, power stations and plans. Each of the following lines contains two positive integers , representing a road between and . It guarantees the input map is a tree. Each of the following lines contains three positive integers $x_i,y_i,p_i(1\leq x_i,y_i\leq n,1\leq p_i\leq 10^9)$. It describes the -th plan. Each of the following lines contains two positive integers . It describes the -th power-stations. There are at most test cases and at most test cases with
Output
For each test case, output lines. in the -th line, if the th plan can be finished, output "YES", otherwise, output "NO"
Sample Input
2
10 3 10
2 1
3 1
4 2
5 1
6 2
7 1
8 2
9 5
10 6
7 2 3
2 6 1
8 8 3
8 6 3
10 3 1
7 9 2
9 5 3
2 2 2
9 8 2
7 10 3
9 1
7 2
8 1
10 3 10
2 1
3 1
4 3
5 4
6 3
7 3
8 6
9 8
10 6
7 9 1
6 8 2
6 9 2
4 3 1
6 9 2
5 2 1
8 2 3
1 5 2
9 5 2
7 10 2
9 1
6 1
2 1
Sample Output
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
NO
YES
Source
2020 Multi-University Training Contest 7