#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const double pi = acos(-1.0);
struct e {
  long long end;
  long long val;
};
long long G = 0;
long long B = 0;
vector<vector<e> > g(200005);
bool vis[200005];
long long sz[200005];
long long dfs(long long u) {
  vis[u] = true;
  for (long long i = 0; i < g[u].size(); i++) {
    long long v = g[u][i].end;
    if (!vis[v]) {
      long long szkid = dfs(v);
      if (szkid % 2 == 0) {
        G -= g[u][i].val;
      }
      sz[u] += szkid;
    }
  }
  sz[u] += 1;
  return sz[u];
}
signed main() {
  long long n, t;
  scanf("%lld", &t);
  while (t--) {
    long long k;
    scanf("%lld", &k);
    G = 0;
    B = 0;
    for (long long i = 1; i <= 2 * k; i++) {
      g[i].clear();
      vis[i] = false;
      sz[i] = 0;
    }
    for (long long i = 1; i < 2 * k; i++) {
      long long u, v, w;
      scanf("%lld%lld%lld", &u, &v, &w);
      g[u].push_back({v, w});
      g[v].push_back({u, w});
      G += w;
    }
    dfs(1);
    long long tmp[2] = {0, 0};
    for (long long i = 1; i <= 2 * k; i++) {
      for (long long j = 0; j < g[i].size(); j++) {
        long long v = g[i][j].end;
        long long val = g[i][j].val;
        tmp[0] = sz[i];
        tmp[1] = sz[v];
        sort(tmp, tmp + 2);
        tmp[1] = 2 * k - tmp[0];
        B += min(tmp[0], tmp[1]) * val;
      }
    }
    B /= 2;
    printf("%lld %lld\n", G, B);
  }
  return 0;
}
