CSES - Shortest Routes I
  • Time limit: 1.00 s
  • Memory limit: 512 MB

There are nn cities and mm flight connections between them. Your task is to determine the length of the shortest route from Syrjälä to every city.

Input

The first input line has two integers nn and mm: the number of cities and flight connections. The cities are numbered 1,2,,n1,2,\dots,n, and city 11 is Syrjälä.

After that, there are mm lines describing the flight connections. Each line has three integers aa, bb and cc: a flight begins at city aa, ends at city bb, and its length is cc. Each flight is a one-way flight.

You can assume that it is possible to travel from Syrjälä to all other cities.

Output

Print nn integers: the shortest route lengths from Syrjälä to cities 1,2,,n1,2,\dots,n.

Constraints

  • 1n1051 \le n \le 10^5
  • 1m21051 \le m \le 2 \cdot 10^5
  • 1a,bn1 \le a,b \le n
  • 1c1091 \le c \le 10^9

Example

Input:

3 4
1 2 6
1 3 2
3 2 3
1 3 4

Output:

0 5 2