The first line contains an integer $T(T \le 1000)$. Then $T$ test cases follow.
For each test case the first line contains one integer $n(1\le n\le 10^5)$.
Then a line with $n$ integers, $p_1, p_2, ..., p_n$ $(0 \le p_i \le 10 ^ 5) $ the power of the islands.
Then $n - 1$ lines, each line containing three integers $u_i$, $v_i$, $w_i$ $ (1 \le u_i, v_i \le n, 1 \le w_i \le 10^5)$ describing a road.
It is guaranteed that $\sum n <4\times10^5 $.