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:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.io.BufferedWriter;
import java.util.ArrayList;
import java.util.AbstractCollection;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 *
 * @author sarthakmanna
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        FastWriter out = new FastWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        int N;
        int M;
        ArrayList<int[]>[] graph;

        public void solve(int testNumber, FastReader in, FastWriter out) {
            int i, j, k;

            // Thanks Geothermal (https://codeforces.com/contest/1473/submission/104310573)
            N = in.nextInt();
            M = in.nextInt();
            int n = N << 2;
            graph = new ArrayList[n];
            for (i = 0; i < n; ++i) graph[i] = new ArrayList<>();
            for (i = 0; i < M; ++i) {
                int a0 = in.nextInt() - 1, b0 = in.nextInt() - 1, w = in.nextInt();
                int a1 = a0 + N, b1 = b0 + N, a2 = a1 + N, b2 = b1 + N, a3 = a2 + N, b3 = b2 + N;

                graph[a0].add(new int[]{b0, w});
                graph[b0].add(new int[]{a0, w});
                graph[a1].add(new int[]{b1, w});
                graph[b1].add(new int[]{a1, w});
                graph[a2].add(new int[]{b2, w});
                graph[b2].add(new int[]{a2, w});
                graph[a3].add(new int[]{b3, w});
                graph[b3].add(new int[]{a3, w});

                // Layer 0 = Starting layer
                // Layer 1 = Maximum edge travelled (and not added to ans)
                // Layer 2 = Minimum edge travelled (and added twice to ans)
                // Layer 3 = Target layer

                graph[a0].add(new int[]{b1, 0});
                graph[b0].add(new int[]{a1, 0});
                graph[a0].add(new int[]{b2, w << 1});
                graph[b0].add(new int[]{a2, w << 1});
                graph[a1].add(new int[]{b3, w << 1});
                graph[b1].add(new int[]{a3, w << 1});
                graph[a2].add(new int[]{b3, 0});
                graph[b2].add(new int[]{a3, 0});
            }

            long[] dist = new long[n];
            Arrays.fill(dist, Long.MAX_VALUE >> 1);
            dist[0] = 0;

            PriorityQueue<Box> pq = new PriorityQueue<>();
            pq.add(new Box(0, 0));
            while (!pq.isEmpty()) {
                Box top = pq.poll();
                int node = top.node;
                if (top.distCovered != dist[node]) continue;

                for (int[] edge : graph[node]) {
                    int otherNode = edge[0], weight = edge[1];
                    long tempWeight = top.distCovered + weight;
                    if (tempWeight < dist[otherNode]) {
                        dist[otherNode] = tempWeight;
                        pq.add(new Box(otherNode, tempWeight));
                    }
                }
            }

            // Above works only when there are atleast 2 edges to travel. Handling all 1-edge cases separately.
            for (int[] itr : graph[0])
                if (itr[0] < N) {
                    int node = itr[0], weight = itr[1];
                    dist[node + 3 * N] = Math.min(dist[node + 3 * N], weight);
                }

            StringBuilder sb = new StringBuilder();
            for (i = 1; i < N; ++i) {
                sb.append(dist[i + 3 * N] + " ");
            }
            System.out.print(sb);
        }

    }

    static class FastWriter {
        BufferedWriter bw;
        StringBuilder sb = new StringBuilder();

        public FastWriter(OutputStream os) {
            //bw = new BufferedWriter(new OutputStreamWriter(os));
        }

        public void print(Object s) {
            sb.append(s);
        }
 
        public void println() {
            sb.append("\n");
        }

        public void close() {
            System.out.print(sb);
        }

    }

    static class Box implements Comparable<Box> {
        int node;
        int minSoFar;
        int maxSoFar;
        long distCovered;

        public Box(int n, long d) {
            node = n;
            distCovered = d;
            minSoFar = Integer.MAX_VALUE >> 1;
            maxSoFar = Integer.MIN_VALUE >> 1;
        }

        public Box(int n, long d, int min, int max) {
            node = n;
            distCovered = d;
            minSoFar = min;
            maxSoFar = max;
        }

        public long calcActualDistance() {
            return distCovered; // - maxSoFar + minSoFar;
        }

        public int compareTo(Box a) {
            return Long.compare(calcActualDistance(), a.calcActualDistance());
        }

    }

    static class FastReader {
        static final int BUFSIZE = 1 << 20;
        static byte[] buf;
        static int index;
        static int total;
        static InputStream in;

        public FastReader(InputStream is) {
            try {
                in = is;
                buf = new byte[BUFSIZE];
            } catch (Exception e) {
            }
        }

        private int scan() {
            try {
                if (index >= total) {
                    index = 0;
                    total = in.read(buf);
                    if (total <= 0)
                        return -1;
                }
                return buf[index++];
            } catch (Exception | Error e) {
                System.err.println(e.getMessage());
                return 13 / 0;
            }
        }

        public int nextInt() {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan()) ;
            boolean neg = c == '-';
            if (c == '-' || c == '+')
                c = scan();
            for (; c >= '0' && c <= '9'; c = scan())
                val = (val << 3) + (val << 1) + (c & 15);
            return neg ? -val : val;
        }

    }
}