The first line contains the number of test cases $T$ $(1\le T\le 100)$.
For each test case, the first line contains two integers $n,m$ $(1\leq n,m\leq 10^5)$ .
The second line contains $n$ integers $a_1,a_2,\cdots,a_n$ $(1\leq a_i\leq 10^8)$ , indicating the number on each hat.
Each of the following $m$ lines contains two integers $u,v$ $(1\le u,v\le n)$ , indicating a pair of friends.
It's guaranteed that there are no self-loop or multiple edges on the graph, and there are at most $20$ test cases such that $n > 1000$ or $m > 1000$.