Dangerous route
In a certain country, there are cities, some of which are connected by two-way roads. The cities are numbered from to . During a financial crisis, crime rates soared, and organized criminal groups began to emerge. As a result, traveling along certain roads became dangerous.
Baha needs to travel from city to city . Since he values both his life and his possessions, he decides to outsmart the robbers by choosing the safest route, even if it's not the shortest. For each road, he has assigned a danger level, represented by an integer between (completely safe) and (extremely dangerous). The danger of a route is determined by the most dangerous road on that route.
Help him find the safest possible route (i.e., the route with the lowest maximum danger).
Input
The first line contains two integers and . Each of the next lines describes one road and contains three integers:
— the cities, connected by the road;
— the danger of the road.
Multiple roads may exist between any two cities.
Output
Print one integer — the danger of the safest route.