There are n cities, connected by m roads. Each road represents a transportation route and has a traffic intensity value wi that indicates its congestion level.
Your task is to find, for each city i, the minimum possible transit congestion from city 1 to city i. The transit congestion of a path is defined as the maximum traffic intensity along that path.
Input
The first line contains two space-separated integers, n and m (1≤n≤105,1≤m≤105), representing the number of cities and the number of roads, respectively.
The next m lines each contain three space-separated integers ai,bi, and wi (1≤ai,bi≤n,1≤wi≤109), representing a road between cities ai and bi with traffic intensity wi.
Output
Output a single line containing n-1 space-separated integers, where the i-th integer represents the minimum possible transit congestion from city 1 to city i+1.