You are given an undirected graph with $$$n$$$ vertices and $$$m$$$ edges, where each edge has a positive weight.
Your task is to construct an array $$$a$$$ of size $$$n$$$ such that the following conditions are satisfied:
The first line contains an integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases.
The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$2 \le n \le 3 \cdot 10^5$$$, $$$1 \le m \le 3 \cdot 10^5$$$) — the number of vertices and the number of edges in the graph.
The next $$$m$$$ lines describe the edges. Each line contains three integers $$$u$$$, $$$v$$$, and $$$w$$$ ($$$1 \le u, v \le n$$$, $$$1 \le w \le 10^9$$$) — the vertices connected by the edge and its weight. It is guaranteed that the graph has no self-loops or multiple edges.
It is guaranteed that the sum of $$$n$$$ and the sum of $$$m$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$.
For each test case, output a single line containing $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ — the array $$$a$$$ that satisfies the given conditions. If there are multiple such arrays, output any of them. If no such array exists, output $$$-1$$$ instead.
33 31 2 12 3 23 1 23 31 2 12 3 21 3 33 11 2 5
1 1 2 -1 1 5 1000000000
| Name |
|---|


