The first line is an integer $t(1 \leq t \leq 10)$, the number of test cases.
For each test case, there are two space-separated integers $n(2 \leq n \leq 100)$ and $m(1 \leq m ≤ 10^{4})$ in the first line, the number of nodes and the number of edges.
Then follows $m$ lines, each contains three integers $u, v, w(1 \leq u, v, \leq n, 1 \leq w \leq 10^{9}, u \neq v)$, space separated, denoting an weight edge between $u$ and $v$ has weight $w$.