func_code_string: #include <bits/stdc++.h>   using namespace std;   long long maxm = 0;   long long nmbr = INT_MAX;   map<long long, bool> vstd;   class graph {    public:     map<long long, list<pair<long long, long long>>> adj;     void input(long long n) {       long long x, y, z;       for (long long i = 1; i < n; i++) {         cin >> x >> y >> z;         adj[x].push_back(make_pair(y, z));         adj[y].push_back(make_pair(x, z));       }     }     void dfs(long long a, long long sum) {       vstd[a] = true;       for (auto j : adj[a]) {         long long nghbr = j.first;         long long wt = j.second;         if (!vstd[nghbr]) {           dfs(nghbr, sum + wt);         }       }       maxm = max(maxm, sum);     }   };   int main() {     graph g;     long long n;     cin >> n;     g.input(n);     g.dfs(0, 0);     cout << maxm;     return 0;   }   