#include <bits/stdc++.h>   const int inf = (1ll << 30) - 1;   const int maxn = (int)1e5 + 10;   using namespace std;   pair<long long, long long> e[100100];   int en;   vector<int> g[100100];   long long dp[100100], d[100100];   int pr[100100];   int used[100100];   long long mi[100100];   int n, m, L, second, t;   void solve() {     scanf( %d%d%d%d%d , &n, &m, &L, &second, &t);     long long cons = (long long)1e9 + 1;     for (int i = 0, a, b, w; i < m; i++) {       scanf( %d%d%d , &a, &b, &w);       if (w == 0) {         g[a].push_back(en);         g[b].push_back(en);         e[en++] = make_pair(a ^ b, cons);       } else {         g[a].push_back(en);         g[b].push_back(en);         e[en++] = make_pair(a ^ b, w);       }     }     for (int i = 0; i < n; i++) {       dp[i] = 2ll * cons * n;     }     dp[t] = 0;     for (int i = 0; i < n; i++) {       int v = -1;       for (int j = 0; j < n; j++) {         if (used[j]) continue;         if (v == -1 || dp[v] > dp[j]) v = j;       }       used[v] = 1;       for (int j = 0; j < g[v].size(); j++) {         int ind = g[v][j];         int to = e[ind].first ^ v;         if (used[to]) continue;         if (e[ind].second < cons) {           dp[to] = min(dp[v] + e[ind].second, dp[to]);         }       }     }     for (int i = 0; i < n; i++) {       d[i] = 2ll * cons * n;       used[i] = 0;     }     d[second] = 0;     for (int i = 0; i < n; i++) {       int v = -1;       for (int j = 0; j < n; j++) {         if (used[j]) continue;         if (v == -1 || d[v] > d[j]) v = j;       }       used[v] = 1;       for (int j = 0; j < g[v].size(); j++) {         int ind = g[v][j];         int to = e[ind].first ^ v;         if (used[to]) continue;         if (e[ind].second < cons) {           d[to] = min(d[v] + e[ind].second, d[to]);         }       }     }     for (int i = 0; i < n; i++) {       used[i] = 0;     }     for (int i = 0; i < n; i++) {       int v = -1;       for (int j = 0; j < n; j++) {         if (used[j]) continue;         if (v == -1 || d[v] > d[j]) v = j;       }       used[v] = 1;       for (int j = 0; j < g[v].size(); j++) {         int ind = g[v][j];         int to = e[ind].first ^ v;         if (e[ind].second < cons) {           d[to] = min(d[v] + e[ind].second, d[to]);         } else {           if (mi[ind] == 0) {             mi[ind] = max(L - d[v] - dp[to], 1ll);           } else {             mi[ind] = max(L - d[v] - dp[to], mi[ind]);           }           d[to] = min(d[v] + mi[ind], d[to]);         }       }     }     for (int i = 0; i < n; i++) {       d[i] = 2ll * cons * n;       used[i] = 0;     }     for (int i = 0; i < en; i++) {       if (e[i].second == cons) e[i].second = mi[i];     }     d[second] = 0;     for (int i = 0; i < n; i++) {       int v = -1;       for (int j = 0; j < n; j++) {         if (used[j]) continue;         if (v == -1 || d[v] > d[j]) v = j;       }       used[v] = 1;       for (int j = 0; j < g[v].size(); j++) {         int ind = g[v][j];         int to = e[ind].first ^ v;         d[to] = min(d[v] + e[ind].second, d[to]);       }     }     if (d[t] != L) {       printf( NO n );       return;     }     printf( YES n );     for (int i = 0; i < n; i++) {       for (int j = 0; j < g[i].size(); j++) {         int ind = g[i][j];         int to = e[ind].first ^ i;         if (to > i) {           printf( %d %d %I64d n , to, i, e[ind].second);         }       }     }   }   int main() {     int t = 1;     for (int i = 1; i <= t; i++) {       solve();     }     return 0;   }