Problem: You are given a weighted undirected connected graph consisting of n vertices and m edges. It is guaranteed that there are no self-loops or multiple edges in the given graph.

Let's define the weight of the path consisting of k edges with indices e_1, e_2, ..., e_k as ∑_{i=1}^{k}{w_{e_i}} - max_{i=1}^{k}{w_{e_i}} + min_{i=1}^{k}{w_{e_i}}, where w_i — weight of the i-th edge in the graph.

Your task is to find the minimum weight of the path from the 1-st vertex to the i-th vertex for each i (2 ≤ i ≤ n).

Input

The first line contains two integers n and m (2 ≤ n ≤ 2 ⋅ 10^5; 1 ≤ m ≤ 2 ⋅ 10^5) — the number of vertices and the number of edges in the graph.

Following m lines contains three integers v_i, u_i, w_i (1 ≤ v_i, u_i ≤ n; 1 ≤ w_i ≤ 10^9; v_i ≠ u_i) — endpoints of the i-th edge and its weight respectively.

Output

Print n-1 integers — the minimum weight of the path from 1-st vertex to the i-th vertex for each i (2 ≤ i ≤ n).

Examples

Input


5 4
5 3 4
2 1 1
3 2 2
2 4 2


Output


1 2 2 4 


Input


6 8
3 1 1
3 6 2
5 4 2
4 2 2
6 1 1
5 2 1
3 2 3
1 5 4


Output


2 1 4 3 1 


Input


7 10
7 5 5
2 3 3
4 7 1
5 3 6
2 7 6
6 2 6
3 7 6
4 2 1
3 1 4
1 7 4


Output


3 4 2 7 7 3 

Solution (in JAVA):

Solution:
/*
package com.company;

import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Cin.init(System.in);
        int n = Cin.nextInt();
        int res = 0;
        long s = 0;
        Map<Long, Boolean> h = new TreeMap<Long, Boolean>();
        for (int i = 0; i < n; ++i) {
            long a = Cin.nextInt();
            s += a;
            if (s == 0 || h.containsKey(s)) {
                ++res;
                s = a;
                h.clear();
            }
            h.put(s, true);
        }
        System.out.println(res);
    }



    */
/***
     * Reader.init(System.in);
     *//*

    static class Cin {
        static BufferedReader reader;
        static StringTokenizer tokenizer;
        static void init(InputStream input) {
            reader = new BufferedReader(   //为输入做初始化，以空格分辨每一个输入
                    new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }
        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {   //读取一个或一组字符串
                //TODO add check for eof if necessary
                tokenizer = new StringTokenizer(
                        reader.readLine());
            }
            return tokenizer.nextToken();
        }
        static int nextInt() throws IOException {     //将next()读取的字符串转化成整型
            return Integer.parseInt(next());
        }
        static double nextDouble() throws IOException {   //读next()读取的字符串转化成双精度型
            return Double.parseDouble(next());
        }
    }
}
*/


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class E3 {

    static final int SIZE=1_300_000;

    static int[] stateNodes=new int[SIZE];
    static long[] stateCosts=new long[SIZE];
    static int stateId=0;

    public static void main(String[] args) {
        FastScanner fs=new FastScanner();
        PrintWriter out=new PrintWriter(System.out);
        int n=fs.nextInt(), m=fs.nextInt();
        Node[] nodes=new Node[n<<2];
        for (int i=0; i<n<<2; i++) nodes[i]=new Node();

        //4*n nodes, 18*m edges
        for (int i=0; i<m; i++) {
            int from=fs.nextInt()-1, to=fs.nextInt()-1;
            int baseCost=fs.nextInt();
            for (int copy=0; copy<nodes.length; copy+=n) {
                add(from+copy, to+copy, baseCost, nodes, true);
            }
            //usedMin, usedMax
            //00 01 10 11

            //take min here
            add(from+0*n, to+1*n, baseCost+baseCost, nodes, false);
            add(from+2*n, to+3*n, baseCost+baseCost, nodes, false);
            add(to+0*n, from+1*n, baseCost+baseCost, nodes, false);
            add(to+2*n, from+3*n, baseCost+baseCost, nodes, false);

            //take max here
            add(from+0*n, to+2*n, baseCost-baseCost, nodes, false);
            add(from+1*n, to+3*n, baseCost-baseCost, nodes, false);
            add(to+0*n, from+2*n, baseCost-baseCost, nodes, false);
            add(to+1*n, from+3*n, baseCost-baseCost, nodes, false);

            //take both here
            add(from+0*n, to+3*n, baseCost-baseCost+baseCost, nodes, false);
            add(to+0*n, from+3*n, baseCost-baseCost+baseCost, nodes, false);
        }

        PQ pq=new PQ();
        nodes[0].dist=0;
        stateCosts[stateId]=0;
        stateNodes[stateId]=0;
        pq.add(stateId++);

        while (!pq.isEmpty()) {
            int nextId=pq.remove(), next=stateNodes[nextId];
            long dist=stateCosts[nextId];
            Node at=nodes[next];
            if (dist!=at.dist) continue;
            for (int i=0; i<at.toList.size; i++) {
                long newCost=dist+at.costList.a[i];
                int to=at.toList.a[i];
                if (newCost<nodes[to].dist) {
                    nodes[to].dist=newCost;
                    stateNodes[stateId]=to;
                    stateCosts[stateId]=newCost;
                    pq.add(stateId++);
                }
            }
        }

        for (int i=1; i<n; i++)
            out.print(nodes[i+3*n].dist+" ");
        out.close();
    }

    static void add(int from, int to, int cost, Node[] nodes, boolean bidir) {
        nodes[from].toList.add(to);
        nodes[from].costList.add(cost);
        if (bidir) {
            nodes[to].toList.add(from);
            nodes[to].costList.add(cost);
        }
    }

    static class PQ {
        int[] a=new int[SIZE];
        int size=0;
        void add(int x) {
            a[++size]=x;
            int i=size;
            while (i>1) {
                if (stateCosts[a[i]]<stateCosts[a[i>>1]]) {
                    int temp=a[i];
                    a[i]=a[i>>1];
                    a[i>>1]=temp;
                }
                i>>=1;
            }
        }

        boolean isEmpty() {
            return size==0;
        }

        int remove() {
            int ret=a[1];
            int i=1;
            a[1]=a[size--];
            while (i<<1<=size) {
                int l=i<<1, r=l+1;
                if (r>size) {
                    if (stateCosts[a[l]]<stateCosts[a[i]]) {
                        int temp=a[i];
                        a[i]=a[l];
                        a[l]=temp;
                    }
                    return ret;
                }
                int o=stateCosts[a[l]]<stateCosts[a[r]]?l:r;
                if (stateCosts[a[o]]>=stateCosts[a[i]]) {
                    return ret;
                }
                int temp=a[i];
                a[i]=a[o];
                a[o]=temp;
                i=o;
            }
            return ret;
        }
    }

    static class Node {
        IntList toList=new IntList();
        IntList costList=new IntList();
        long dist=Long.MAX_VALUE;
    }

    static class IntList {
        int[] a=new int[17];
        int size=0;
        int get(int i) {
            return a[i];
        }
        void add(int x) {
            if (size==a.length) {
                int[] temp=new int[a.length<<1];
                for (int i=0; i<size; i++) temp[i]=a[i];
                a=temp;
            }
            a[size++]=x;
        }
        int size() {
            return size;
        }
    }

    static void ruffle_sort(int[] a) {
        //shandom_ruffle
        Random r=new Random();
        int n=a.length;
        for (int i=0; i<n; i++) {
            int oi=r.nextInt(n);
            int temp=a[i];
            a[i]=a[oi];
            a[oi]=temp;
        }

        //sort
        Arrays.sort(a);
    }

    static class FastScanner {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        String next() {
            while (!st.hasMoreTokens())
                try {
                    st=new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        int[] readArray(int n) {
            int[] a=new int[n];
            for (int i=0; i<n; i++) a[i]=nextInt();
            return a;
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }


}