#include using namespace std; template ostream& operator<<(ostream& os, const vector& v){ os << "{"; for(auto e : v){ os << e << ","; } os << "}"; return os; } using ll = long long; constexpr long long linf = numeric_limits::max()/3; struct edge{ int from,to; ll cost; edge(int f,int t,ll c) : from(f), to(t), cost(c){} edge(){} }; int main(){ int n,m,s,g; cin >> n >> m >> s >> g; vector> G(n); vector> dist(n,vector(n,linf)); for(int i=0;i> a >> b >> c; G[a].emplace_back(a,b,c); G[b].emplace_back(b,a,c); dist[a][b] = c; dist[b][a] = c; } for(int k=0;k ans; ans.push_back(s); int now = s; for(int i=0;i nexts; for(auto e : G[now]){ if(e.cost + dist[e.to][g] == dist[now][g]){ nexts.emplace_back(e.to); } } sort(nexts.begin(), nexts.end()); //cout << now << " " << nexts << endl; //assert(nexts.size() > 0); ans.push_back(nexts[0]); now = nexts[0]; if(now == g){ break; } } for(int i=0;i