#include <bits/stdc++.h>
using namespace std;
long long t, k;
const long long N = 2e5 + 10;
vector<pair<long long, long long> > g[N];
long long sz[N];
struct node {
  long long a, b, t;
} p[N];
void dfs(long long x, long long fa) {
  sz[x] = 1;
  for (long long i = 0; i < g[x].size(); i++) {
    if (g[x][i].first == fa) continue;
    ;
    dfs(g[x][i].first, x);
    sz[x] += sz[g[x][i].first];
  }
}
int32_t main() {
  cin >> t;
  while (t--) {
    cin >> k;
    memset(sz, 0, sizeof sz);
    for (long long i = 1; i <= 2 * k; i++) g[i].clear();
    for (long long i = 1; i <= 2 * k - 1; i++) {
      long long a, b, t;
      scanf("%lld%lld%lld", &a, &b, &t);
      p[i] = {a, b, t};
      g[a].push_back({b, t});
      g[b].push_back({a, t});
    }
    long long mini = 0, maxi = 0;
    dfs(1, -1);
    for (long long i = 1; i <= 2 * k - 1; i++) {
      long long a, b, t;
      a = p[i].a, b = p[i].b, t = p[i].t;
      long long tp = min(sz[a], sz[b]);
      if (tp % 2 == 1) mini += t;
      maxi += min(tp, 2 * k - tp) * t;
    }
    cout << mini << " " << maxi << endl;
  }
}
