#t536. 繁忙的都市

繁忙的都市

Road Reconstruction

Special for beginners, ^_^

Problem Description

City C is a very busy metropolis, and its roads are terribly congested, so the mayor decided to renovate some of the roads. City C's roads are laid out as follows: there are nn intersections; some pairs of intersections are connected by roads, and at most one road connects any pair of intersections. These roads are bidirectional and connect all intersections directly or indirectly. Each road has a score: the smaller the score, the busier the road and the more it needs renovation. But the city's budget is limited and the mayor wants to renovate as few roads as possible, so he sets the following requirements:

  1. The renovated roads must connect all intersections directly or indirectly.

  2. Among the roads satisfying requirement 1, the number of renovated roads should be as small as possible.

  3. Among the roads satisfying requirements 1 and 2, the maximum score among the renovated roads should be as small as possible.

As a member of the city planning bureau, you should make the best decision about which roads to build.

Input Format

The first line has two integers n,mn,m: the city has nn intersections and mm roads. The next mm lines describe each road: u,v,cu, v, c means there is a road of score cc between intersections uu and vv. (1≤n≤3001\le n\le300, 1≤c≤100001\le c\le10000).

Output Format

Two integers s,maxs, max: how many roads you chose, and the score of the highest-scoring road among them.

Sample Input 1

4 5
1 2 3
1 4 5
2 4 7
2 3 6
3 4 8

Sample Output 1

3 6

Constraints

1s, 1024KiB for each test case.