This problem has multiple sets of test data. The first line contains a positive integer, indicating the number of sets of data.
For each set of data:
The first line contains three positive integers.
The nextlines each contain three positive integers
, indicating an edge from
to
with weight
.
Output one line for each set of data, which is the answer.