func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   vector<pair<int, bool> > v[300100];   set<pair<int, int> > Bridges;   vector<pair<pair<int, int>, int> > All;   bool vis[300100], F = 0;   int cnt = 0, num[300100], low[300100], Size[300100], par[300100], a, b;   bool Ok[300100];   void init() {     for (int i = 1; i <= n; i++) par[i] = i, Size[i] = 1;   }   int getparent(int x) {     if (x == par[x]) return x;     return par[x] = getparent(par[x]);   }   void Merge(int x, int y) {     x = getparent(x);     y = getparent(y);     if (Size[x] < Size[y]) swap(x, y);     Size[x] += Size[y];     par[y] = x;   }   void BridgeDFS(int u) {     num[u] = low[u] = cnt++;     for (int i = 0; i < v[u].size(); i++) {       int nxt = v[u][i].first;       if (num[nxt] == -1) {         par[nxt] = u;         BridgeDFS(nxt);         if (num[u] < low[nxt]) Bridges.insert({u, nxt}), Bridges.insert({nxt, u});         low[u] = min(low[u], low[nxt]);       } else if (par[u] != nxt)         low[u] = min(low[u], num[nxt]);     }   }   void DFS(int x, bool f) {     vis[x] = true;     if (x == getparent(b)) F = f;     for (int i = 0; i < v[x].size(); i++) {       int y = getparent(v[x][i].first);       if (!vis[y]) {         DFS(y, f || Ok[y] || v[x][i].second);       }     }   }   int main() {     memset(num, -1, sizeof(num));     memset(par, -1, sizeof(par));     int x, y, w;     cin >> n >> m;     while (m--) {       scanf( %d%d%d , &x, &y, &w);       v[x].push_back({y, w});       v[y].push_back({x, w});       All.push_back({{x, y}, w});     }     cin >> a >> b;     BridgeDFS(1);     init();     for (auto it : All) {       if (Bridges.find(it.first) == Bridges.end()) {         int val = max(it.second, max((int)Ok[getparent(it.first.first)],                                      (int)Ok[getparent(it.first.second)]));         Merge(it.first.first, it.first.second);         Ok[getparent(it.first.first)] =             max((int)Ok[getparent(it.first.first)], val);       }     }     for (auto it : All) {       int x = getparent(it.first.first);       int y = getparent(it.first.second);       if (x != y) {         v[x].push_back({y, it.second});         v[y].push_back({x, it.second});       }     }     if (getparent(a) == getparent(b)) {       int u = getparent(a);       if (Ok[u])         return cout <<  YES , 0;       else         return cout <<  NO , 0;     }     DFS(getparent(a), Ok[getparent(a)]);     if (F)       return cout <<  YES , 0;     else       return cout <<  NO , 0;     return 0;   }   