func_code_string: #include <bits/stdc++.h>   using namespace std;   class trio {    public:     long long first, second, third;   };   class quad {    public:     long long first, second, third, fourth;   };   class DSU {    public:     long long *par, *size;     DSU(long long n) {       par = new long long[n + 1];       size = new long long[n + 1];       for (long long i = 0; i < n + 1; ++i) {         par[i] = i;         size[i] = 0;       }     }     long long find(long long a) {       long long p = a, third;       while (par[p] != p) p = par[p];       while (p != a) {         third = par[a];         par[a] = p;         a = third;       }       return a;     }     void union_(long long a, long long b) {       long long u1 = find(a);       long long u2 = find(b);       if (size[u1] < size[u2]) {         par[u1] = u2;       } else {         if (size[u2] < size[u1]) {           par[u2] = u1;         } else {           par[u1] = u2;           size[u1]++;         }       }     }   };   bool mycom(quad a, quad b) { return a.first < b.first; }   long long *intime, *outime, timt = 1;   bool inacestor(long long a, long long b) {     return (intime[a] <= intime[b] && outime[a] >= outime[b]);   }   long long tree[100010][20];   long long dp[100010][20];   void dfs(long long i, list<pair<long long, long long> > *adj) {     intime[i] = timt;     timt++;     for (auto it : adj[i]) {       if (it.first != tree[i][0]) {         tree[it.first][0] = i;         dp[it.first][0] = it.second;         dfs(it.first, adj);       }     }     outime[i] = timt;     timt++;   }   long long func(long long a, long long b) {     long long ans = 0;     for (long long j = 19; j >= 0; --j) {       if (inacestor(tree[a][j], b)) continue;       ans = max(ans, dp[a][j]);       a = tree[a][j];     }     for (long long j = 19; j >= 0; --j) {       if (inacestor(tree[b][j], a)) continue;       ans = max(ans, dp[b][j]);       b = tree[b][j];     }     if (!inacestor(a, b) && !inacestor(b, a)) {       ans = max(ans, dp[b][0]);       ans = max(ans, dp[a][0]);     } else {       if (inacestor(a, b)) {         ans = max(ans, dp[b][0]);       } else         ans = max(ans, dp[a][0]);     }     return ans;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long n, m;     cin >> n >> m;     quad edges[m + 1];     bool select[m + 1];     memset(select, 0, sizeof(select));     for (long long i = 0; i < m; ++i) {       cin >> edges[i].second >> edges[i].third >> edges[i].first;       edges[i].fourth = i;     }     sort(edges, edges + m, mycom);     DSU dsu1(n);     long long ans[m + 1];     for (long long i = 0; i < m; ++i) {       ans[i] = -1;     }     list<pair<long long, long long> > adj[n + 1];     for (long long i = 0; i < m; ++i) {       if (dsu1.find(edges[i].second) != dsu1.find(edges[i].third)) {         dsu1.union_(edges[i].second, edges[i].third);         select[i] = 1;         adj[edges[i].second].push_back({edges[i].third, edges[i].first});         adj[edges[i].third].push_back({edges[i].second, edges[i].first});       }     }     intime = new long long[n + 1];     outime = new long long[n + 1];     tree[1][0] = -1;     dfs(1, adj);     tree[1][0] = 1;     dp[1][0] = 0;     for (long long j = 1; j < 20; ++j) {       for (long long i = 1; i < n + 1; ++i) {         tree[i][j] = tree[tree[i][j - 1]][j - 1];         dp[i][j] = max(dp[tree[i][j - 1]][j - 1], dp[i][j - 1]);       }     }     for (long long j = 0; j < m; ++j) {       if (select[j] == 0) {         ans[edges[j].fourth] = func(edges[j].second, edges[j].third);       }     }     for (long long i = 0; i < m; ++i) {       if (ans[i] != -1) {         cout << ans[i] << endl;       }     }   }   