The first line of input is a positive integer T(T≤15) representing the number of test cases. Desc
The first line of each test case contains two integers n and m (1≤n≤500,0≤m≤n×(n−1))—— the number of the vertices and edges in the given graph.
Each of the next m lines contains two integers ui , vi and wi (1≤ui,vi≤n,1≤wi≤10^9)meaning that there is a directed edge of length wi between vertex ui and vertex vi in the graph.
The data guarantees that there will be no more than 1010 groups with a value of n exceeding 100.
3
3 4
1 2 4
2 1 3
2 3 2
3 1 1
2 1
1 2 1
5 7
1 2 4
2 1 4
1 3 1
3 4 1
4 2 2
2 5 2
5 1 2
7 2
-1 -1
8 4