10305: CF EDU - DSU - Step 2 - G. No refuel
[Creator : ]
Description
There are several roads between cities 1, 2, ...,n. The length of each road is known. The road network is connected, i.e., there is a path between any pair of cities. Gas stations are located only in the cities. You have to calculate what is the maximal distance that the car should be able to pass in order to have no problems driving between cities.
Input
The first line of the input contains two integers $n, k\ (1 ≤n≤ 1 ,500, 1 ≤k≤ 400 ,000)$ — the number of cities and the number of roads, respectively.
Next $k$ lines contain the desc
Output
The output should contain one integer — the longest distance the car should be able to pass without refuel.
Sample 1 Input
3 2
1 2 5
1 3 10
Sample 1 Output
10