The first line contains one integer T($1 \leq T \leq 40$) and there are exactly T test cases below.
For each test case, the first line contains one integer n ($1 \leq n \leq 2 \times 10^4$).
The following n - 1 lines describe edges in the tree. Each line contains two integers $a_i$ and $b_i (1 \leq a_i,b_i \leq n,a_i \neq b_i)$ describing an edge of the tree.
For the following n lines, the i-th line contains two integers $c_i$ and $v_i (1 \leq c_i \leq 5,1 \leq v_i \leq 10^9)$.
Next line contains one integer the number of queries Q and each of the following Q lines contains two integers $s_i$ and $t_i (1 \leq s_i \leq n, 1 \leq t_i \leq 10^5)$ as a query.
Note that node 1 is the root of the tree.
There is no more than 4 test cases that n is greater than $10^4$, and no more than 10 test cases that n is greater than $10^3$. sum of all Q are not greater than $2 \times 10^5$.