There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case:
The first line contains two integers $n$ and $m$ $(2 \le n \le 10^5, 1 \le m \le 2 \times 10^5)$ -- the number of vertices and the number of edges.
The second line contains $n$ integers $w_1, w_2, ..., w_n$ $(1 \le w_i \le 10^9)$, denoting the weight of each vertex.
In the next m lines, each contains two integers $x_i$ and $y_i$ $(1 \le x_i, y_i \le n, x_i \ne y_i)$, denoting an undirected edge.
There are at most $1000$ test cases and $\sum n, \sum m \le 1.5 \times 10^6$.