func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 3e5 + 7;   vector<pair<int, int> > G[MAXN];   int n;   int sz[MAXN];   long long MAX, MIN;   void dfs(int u, int fa) {     sz[u] = 1;     for (pair<int, int> edge : G[u]) {       int v = edge.first;       if (v == fa) continue;       dfs(v, u);       sz[u] += sz[v];     }     for (pair<int, int> edge : G[u]) {       int v = edge.first, w = edge.second;       if (v == fa) continue;       if (sz[v] & 1) MIN += w;       MAX += 1ll * w * min(sz[v], (n - sz[v]));     }   }   int main() {     int T;     scanf( %d , &T);     while (T--) {       int k;       scanf( %d , &k);       n = 2 * k;       for (int i = 1, u, v, w; i < n; i++) {         scanf( %d%d%d , &u, &v, &w);         G[u].push_back({v, w});         G[v].push_back({u, w});       }       MAX = MIN = 0;       dfs(1, 0);       printf( %lld %lld n , MIN, MAX);       for (int i = 1; i <= n; i++) G[i].clear();     }     return 0;   }   