First line has one integer $T$, indicating there are $T$ test cases. In each case:
First line has two integers $n, m$, indicating the number of nodes and the number of wires.
For next $m$ lines, each line has $3$ integers $u, v, w$, indicating a wire connecting node $u$ and node $v$, and there're $w$ components on the wire.
It is guaranteed that the graph is connected and doesn't contain loops or multiple edges, the number of wires with a same $w$ would be no more than $10^2$ .
$1 \leq n, w_i \leq 10^5, n - 1 \leq m \leq \min(\frac{n(n-1)}{2}, 2 \times 10^5), \sum m \leq 10^6$