func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long N = 3e5 + 5;   vector<long long> adj[N];   vector<pair<long long, long long> > lol[N];   long long x[N], y[N], z[N], vis[N], tin[N], low[N], bridge[N], comp[N],       artificat[N], depth[N], par[N], path[N], timer, cur;   void dfs1(long long node, long long prvId) {     vis[node] = 1;     tin[node] = low[node] = ++timer;     for (auto &id : adj[node]) {       if (id == prvId) continue;       long long v = x[id] ^ y[id] ^ node;       if (!vis[v])         dfs1(v, id), low[node] = min(low[node], low[v]);       else         low[node] = min(low[node], tin[v]);       if (low[v] > tin[node]) bridge[id] = 1;     }   }   void dfs2(long long node) {     comp[node] = cur;     vis[node] = 1;     for (auto &id : adj[node]) {       if (bridge[id]) continue;       if (z[id]) artificat[cur] = 1;       long long v = x[id] ^ y[id] ^ node;       if (!vis[v]) dfs2(v);     }   }   void dfs3(long long node, long long pr) {     depth[node] = depth[pr] + 1;     par[node] = pr;     for (auto &ele : lol[node])       if (ele.first != pr) path[ele.first] = ele.second, dfs3(ele.first, node);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, m;     cin >> n >> m;     for (long long i = 1; i <= m; i++) {       cin >> x[i] >> y[i] >> z[i];       adj[x[i]].push_back(i);       adj[y[i]].push_back(i);     }     dfs1(1, 0);     for (long long i = 1; i <= n; i++) vis[i] = 0;     for (long long i = 1; i <= n; i++)       if (!vis[i]) cur++, dfs2(i);     for (long long i = 1; i <= m; i++) {       if (bridge[i]) {         lol[comp[x[i]]].push_back({comp[y[i]], z[i]});         lol[comp[y[i]]].push_back({comp[x[i]], z[i]});       }     }     dfs3(1, 0);     long long s, t;     cin >> s >> t;     s = comp[s], t = comp[t];     while (s != t) {       if (depth[s] < depth[t]) swap(s, t);       if (artificat[s] || path[s]) return cout <<  YES , 0;       s = par[s];     }     cout << (artificat[s] ?  YES  :  NO );   }   