You are given a connected undirected graph with vertices and edges. The vertices are numbered from to , and the edges are numbered from to in input order. Vertex has weight . The graph has no self-loops and no multiple edges between the same pair of vertices.
Remove all edges by performing the following operation exactly times.
Find the minimum total cost of removing all edges and an edge removal order that achieves it.
The input is given in the following format.
For each test case, print the following two lines in input order.
If there are multiple optimal removal orders, print any of them.
For the first test case, remove the edges as follows.
The first line contains the number of test cases . Each test case has the following format.
The first line of each test case contains the number of vertices and the number of edges . The second line contains the vertex weights .
The -th of the next lines contains the endpoints of edge .
| 2 | 24 | . |
| 3 | 28 |
|
| 4 | 37 | No additional constraints. |
The total cost is .
For the second test case, removing edge first costs , and then removing edge costs . The total is .
In the first test case, both endpoint weights are always equal, so every removal costs and the total is . In the second test case, removing the only edge separates its endpoints and costs .