func_code_string: #include <bits/stdc++.h>   using namespace std;   long long k;   long long maxi = 0, mini = 0;   vector<long long> v[200001];   long long dp[200001];   unordered_map<long long, unordered_map<long long, long long> > dis;   long long f(long long parent) {     if (dp[parent] > 0) return dp[parent];     dp[parent] = -1;     long long ans = 0;     for (long long i = 0; i < v[parent].size(); i++) {       long long child = v[parent][i];       if (dp[child] != -1) ans += f(child);     }     dp[parent] = ans + 1;     for (long long i = 0; i < v[parent].size(); i++) {       long long child = v[parent][i];       if (dp[child] != -1) {         maxi += (min(dp[child], 2 * k - dp[child]) * (dis[child][parent]));         if (dp[child] % 2 == 1 || 2 * k - dp[child] % 2 == 1)           mini += dis[child][parent];       }     }     return dp[parent];   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     while (t--) {       maxi = 0;       mini = 0;       long long start;       cin >> k;       for (long long i = 1; i <= 2 * k; i++) v[i].clear();       dp[2 * k - 1] = 0;       dp[2 * k] = 0;       for (long long i = 0; i < 2 * k - 1; i++) {         dp[i] = 0;         long long u1, u2, time;         cin >> u1 >> u2 >> time;         v[u1].push_back(u2);         v[u2].push_back(u1);         dis[u2][u1] = time;         dis[u1][u2] = time;       }       for (long long i = 1; i <= 2 * k; i++) {         if (v[i].size() == 1) {           start = i;           dp[i] = 1;         }       }       dp[start] = -1;       f(start);       cout << mini <<     << maxi << endl;     }     return 0;   }   