First line of input is integerthat represents the number of test cases. Each test case starts with a line with two integers
and
, that represents the number of check points and the number of paths to consider respectively. In the following M lines, there are 3 integers
and
that represent the start check points (a), the end check points (b) and the distance of the path (d) that connects check points a and b.
For each test case, output the minimum distance as shown in the sample output.