SUPPORT SCHOOLS#8300

SUPPORT SCHOOLS

0.5 seconds
64 megabytes
Very hard

As part of the decentralization process, the task of establishing hub schools has emerged. There are villages in the district, some of which are connected by roads. The connections between villages and the distances along these roads are known. It is essential to ensure that students from all villages in the district can reach the hub school. If multiple routes to the school exist, students will choose the shortest one. Your task is to determine in which village the school should be located so that the distance to the farthest village is minimized.

Input

The first line contains two numbers: - the number of villages (2 \leq N \leq 1000), and - the number of roads with known lengths (2 \leq M \leq \frac{N \cdot (N-1)}{2}).

The next lines provide information about the roads, each containing three numbers: two integers representing the villages connected by the road, and one positive real number indicating the length of that road.

Output

On the first line, output the number of the village where the hub school should be located. If there are multiple suitable villages, list their numbers in ascending order.

On the second line, output the distance from the school to the farthest village, rounded to decimal places. If the problem has no solution, output the number .

z4.jpg

The hub school should be placed in village No. . The distances from it to other villages are:

  • to No. - km,

  • to No. - km,

  • to No. - km.

Thus, the farthest village is located at a distance of km.

Examples

Example 1

Loading
Loading