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 comment(linker, "/STACK:102400000,102400000")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
//#define int ll
#define ff first
#define ss second
#define debug(x) std:: cerr << #x << " = " << x << std::endl;
const int maxn=6e5+10,inf=0x3f3f3f3f,mod=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;
const double eps=1e-9;
//#define DEBUG//#define lowbit(x) ((x) & -(x))//<<setiosflags(ios::fixed)<<setprecision(9)
void read(){}
template<typename T,typename... T2>inline void read(T &x,T2 &... oth) {
	x=0; int ch=getchar(),f=0;
	while(ch<'0'||ch>'9'){if (ch=='-') f=1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	if(f)x=-x;
	read(oth...);
}
struct edge
{
	int v,nex;
	ll w;
	edge(){}
	edge(int v,ll w,int nex=0):
		v(v),w(w),nex(nex){}
};
vector<edge>G1[maxn],G2[maxn];
inline void add(vector<edge> g[],int u,int v,ll w)
{
	g[u].push_back(edge(v,w));
}
ll d1[maxn],d2[maxn];
void dijkstra(ll d[],vector<edge> g[],int n,int st)
{
//	memset(d,0x3f,sizeof(d));
	for(int i=1;i<=3*n;i++)
		d[i]=INF;
	vector<bool> vis(3*n+1,false);
	typedef pair<ll,int>pli;
	priority_queue<pli,vector<pli>,greater<pli>> q;
	q.push(pli(0,st));
	d[st]=0;
	while(!q.empty())
	{
		pli x=q.top();
		q.pop();
		if(vis[x.ss])
			continue;
		vis[x.ss]=1;
//		d[x.ss]=x.ff;
		for(edge &e:g[x.ss])
		{
			if(!vis[e.v]&&d[x.ss]+e.w<d[e.v])
			{
				d[e.v]=d[x.ss]+e.w;
				q.push(pli(d[x.ss]+e.w,e.v));
			}
		}
	}
}
signed main(signed argc, char const *argv[])
{
	std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	#ifdef DEBUG
		freopen("input.in", "r", stdin);
	//	freopen("output.out", "w", stdout);
	#endif
	int n,m,u,v,w;
	read(n,m);
//	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		read(u,v,w);
//		cin>>u>>v>>w;
		add(G1,u,v,w),add(G1,v,u,w);
		add(G1,n+u,n+v,w),add(G1,n+v,n+u,w);
		add(G1,2*n+u,2*n+v,w),add(G1,2*n+v,2*n+u,w);
		add(G1,u,n+v,0),add(G1,v,n+u,0);//可被忽略
		add(G1,n+u,2*n+v,2*w),add(G1,n+v,2*n+u,2*w);//代价翻倍

		add(G2,u,v,w),add(G2,v,u,w);
		add(G2,n+u,n+v,w),add(G2,n+v,n+u,w);
		add(G2,2*n+u,2*n+v,w),add(G2,2*n+v,2*n+u,w);
		add(G2,u,n+v,2*w),add(G2,v,n+u,2*w);//代价翻倍
		add(G2,n+u,2*n+v,0),add(G2,n+v,2*n+u,0);//可被忽略
	}
	dijkstra(d1,G1,n,1);
	dijkstra(d2,G2,n,1);
//	for(int i=1;i<=3*n;i++)
//	{
//		cerr<<"d1["<<i<<"] = "<<d1[i]<<' ';
//		if(i%n==0)
//			cerr<<endl;
//	}
	for(int i=2;i<=n;i++)
	{
		printf("%lld ",min({d1[i],d1[n*2+i],d2[n*2+i]}));
//		cout<<min({d1[i],d1[n*2+i],d2[n*2+i]})<<' ';
	}
	return 0;
}
/*
 *n点m边,
 *分层图,建三层图
 *对于每条边,在第一层和第二层之间连一条单向权值为0的边
 *表示如果走了该边的话,这条边的边权不计贡献
 *同样对于每条边,在第二层和第三层之间连一条权值翻倍的边
 *表示如果走了这条边,权值翻倍
 *假如最大边和最小边是同一条边,效果抵消
*/