The first line of the input contains an integer $T$ $(1 \leq T \leq 10^4)$, representing the number of test cases.
The first line of each test case contains an integer $n$ $(1 \leq n \leq 10^5)$, representing the number of nodes.
Each of the following $n - 1$ lines contains two integers $u, v$ $(1 \leq u, v \leq n)$, representing an edge connecting node $u$ and node $v$. It is guaranteed that the input will form a tree.
The next line contains $n$ $\textbf{distinct}$ integers $a_1, a_2, \ldots, a_n$ $(1 \leq a_i \leq 10^9)$, representing the weight of each node.
It is guaranteed that the sum of $n$ over all test cases does not exceed $8 \times 10^5$.