#include using namespace std; //#define int long long typedef long long ll; typedef pairpint; typedef vectorvint; typedef vectorvpint; #define pb push_back #define mp make_pair #define fi first #define se second #define ln <void chmin(T &t,U f){if(t>f)t=f;} templatevoid chmax(T &t,U f){if(t>N>>M>>X>>Y; fill_n(*dist,200*200,1<<25); rep(i,N)dist[i][i]=0; memset(G,-1,sizeof(G)); rep(i,M){ int a,b,c; cin>>a>>b>>c; G[a][b]=G[b][a]=c; dist[a][b]=dist[b][a]=c; } rep(k,N)rep(i,N)rep(j,N)chmin(dist[i][j],dist[i][k]+dist[k][j]); int v=X; vint ans;ans.pb(X); while(v!=Y){ int u=114514; rep(i,N){ if(G[v][i]==-1)continue; if(dist[Y][i]+G[v][i]==dist[Y][v])chmin(u,i); } ans.pb(u); v=u; } rep(i,ans.size()){ if(i)cout<<" "; cout<