Gasoline#824

Gasoline

5 seconds
64 megabytes
Easy

Between points numbered 1, 2, \ldots, N (N \leq 150), a network of roads has been established. The length of each road is known. This road network allows travel between any two points. Gas stations are located only at these points. Determine the maximum distance a car must be able to travel on a single tank of gas to ensure it can move between any two points in this network without needing to refuel.

Input

The first line contains and (the number of roads). The next lines describe pairs of points connected by roads and the distance between them — a positive integer in kilometers not exceeding . K \leq 150^2.

Output

Print a single number — the maximum distance that can be traveled without refueling.

Examples

Example 1

Loading
Loading