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 CPP):

Solution:
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
    
#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
     
using namespace std;
//using namespace __gnu_pbds;
     
void err(istream_iterator<string> it) {cout << '\n';}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    string s = typeid(a).name();
    cout << "[" << *it << " = ";
    cout << a;
    cout << "] ";
    err(++it, args...);
}
     
#define F first
#define S second
#define ll long long
#define ull unsigned ll
#define pb push_back
#define pf push_front
#define db double
#define ld long double
#define ofk order_of_key
#define fbo find_by_order
#define ppb pop_back
#define ppf pop_front
#define br cout << '\n'
#define pll pair<long long, long long>
#define here cout << "HERE\n"
#define bruh cout << "BRUH\n"
#define all(x) (x).begin(),(x).end()
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define TEST int TT; cin >> TT; for(int T = 1; T <= TT; T++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
    
int gcd(int a, int b) {if (a < b) swap(a, b); return b ? gcd(b, a % b) : a;}
ll gcd(ll a, ll b) {if (a < b) swap(a, b); return b ? gcd(b, a % b) : a;}
   
pair<int, int> dx[] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
     
int inf = 2e9 + 7;
ll INF = 9e18 + 7;
//ld pi = 3.1415926535897932384626433;
db eps = 1e-7;
//ld EPS = 1e-9;
int mod = 1e9 + 7;
int mod2 = 1000010029;
int BASE = 1000117;
int base = 29;
ll MOD = 1e15 + 7;
    
mt19937 lol(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 rofl(chrono::steady_clock::now().time_since_epoch().count());
    
//random_device random_device;
//mt19937 generator(random_device());
    

void Add(int &a, int b) {
    a += b;
    if (a >= mod) a -= mod;
}
void Sub(int &a, int b) {
    a -= b;
    if (a < 0) a += mod;
}
int add(int a, int b) {
    a += b;
    if (a >= mod) a -= mod;
    return a;
}
int sub(int a, int b) {
    a -= b;
    if (a < 0) a += mod;
    return a;
}
int mul(int a, int b) {
    return a * 1ll * b % mod;
}
int bp(int a, int n, int mOd = mod) {
    if (n == 0) return 1;
    int res = bp(a, n / 2, mOd);
    res = res * 1ll * res % mOd;
    if (n & 1) res = res * 1ll * a % mOd;
    return res;
}
int inv(int a, int mOd = mod) {
    return bp(a, mOd - 2, mOd);
}
bool is_prime(int a) {
    for (int i = 2; i * i <= a; i++) {
        if (a % i == 0) return 0;
    }
    return 1;
}

const bool multiple_tests = 0;
const int N = 2e5 + 7;

// #define int long long
#define pii pair<int, int>

int n, m;
ll d[N][2][2];
vector<pii> g[N];

void solve() {
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        g[a].pb({b, c});
        g[b].pb({a, c});
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 2; j++) {
            for (int k = 0; k < 2; k++) {
                d[i][j][k] = INF;
            }
        }
    }
    d[1][0][0] = 0;
    priority_queue<array<ll, 4>, vector<array<ll, 4>>, greater<array<ll, 4>>> q;
    q.push({0, 0, 0, 1});
    // {dist, cntmn, cntmx, v}
    while (!q.empty()) {
        auto [dist, mn, mx, v] = q.top();
        q.pop();
        if (d[v][mn][mx] < dist) continue;
        for (auto [to, len]: g[v]) {
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 2; j++) {
                    if (i >= mn && j >= mx) {
                        ll cost = dist + len;
                        if (i > mn) cost += len;
                        if (j > mx) cost -= len;
                        if (d[to][i][j] > cost) {
                            d[to][i][j] = cost;
                            q.push({cost, i, j, to});
                        }
                    }
                }
            }
        }
    }
    for (int i = 2; i <= n; i++) {
        cout << d[i][1][1] << ' ';
    }
}

// KEEP IT SIMPLE


signed main() { __
    // freopen("sum.in", "r", stdin);
    // freopen("sum.out", "w", stdout);
    int TT = 1;
    if (multiple_tests) cin >> TT;
    for (int testcase = 1; testcase <= TT; testcase++) {
        solve();
        cout << '\n';
    }
        
//    #ifndef ONLINE_JUDGE
//      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
//    #endif
    return 0;
}