There might be multiple test cases, no more than $20$. You need to read till the end of input.
For each test case,In the first line, two integers $N$ $(2 \le N \le 100000)$ and $M$ $(0 \le M \le 200000)$, representing the number of ports and shipping lines in the city.
In the following m lines, each contain three integers, the first and second representing two ends $A_i$ and $B_i$ of a shipping line $(1 \le A_i, B_i \le N)$ and the third representing the identification number $C_i$ $(1 \le C_i \le 1000000)$ of Weitian who occupies this shipping line.