Consider a connected, undirected multigraph with labels at the edges. Define the cost of as the sum of its labels. You must compute the minimum cost that can be obtained after removing zero or more edges without disconnecting . Among all the solutions that achieve cost , you must also compute the minimum number of remaining edges , and the maximum number of remaining edges .
For instance, consider these two graphs:
The minimum possible cost of the first graph is 8, and there is just one way to achieve it, namely removing one of its seven edges: the 1–2 edge. Thus , . As for the second graph, it is easy to see that , , and .
Input is all integers, and consists of several descriptions of connected multigraphs. Every description starts with the number of vertices and the number of edges . Then follow triples, one for every edge, with its two vertices and its label in this order. The vertices are numbered from 0 to . Assume .
For every given graph, output , and in one line.
Input
6 7 0 1 3 0 2 5 1 2 7 2 3 15 4 5 -7 3 4 -5 3 5 -3 2 4 1 0 0 0 0 0 0 1 -3 1 0 -3
Output
8 6 6 -6 2 4