The first line of input will contain a number $T (1 \leq T \leq 30)$ which is the number of test cases.
For each test case, the first line contains two number separated by a blank. One is the number $p (1 \leq p \leq 10^4)$ which represents the number of ponds she owns, and the other is the number $m (1 \leq m \leq 10^5)$ which represents the number of pipes.
The next line contains $p$ numbers $v_1, . . . , v_p$, where $v_i (1 \leq v_i \leq 10^8)$ indicating the value of pond $i$.
Each of the last $m$ lines contain two numbers $a$ and $b$, which indicates that pond $a$ and pond $b$ are connected by a pipe.