#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
long long D[200009];
int sub[200009], pc[200009];
vector<pii> G[200009];
void dfs(int x, int p, long long ds) {
  sub[x] = 1;
  D[x] = ds;
  for (auto& it : G[x]) {
    if (it.first != p) {
      dfs(it.first, x, ds + it.second);
      sub[x] += sub[it.first];
      pc[it.first] = it.second;
    }
  }
}
int cent(int rt) {
  int nw = rt, pr = rt;
  while (1) {
    int mxi = -1;
    for (auto& it : G[nw])
      if (it.first != pr) {
        if (mxi == -1 || sub[mxi] < sub[it.first]) mxi = it.first;
      }
    if (mxi == -1 || sub[mxi] * 2 <= sub[rt]) return nw;
    pr = nw;
    nw = mxi;
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    long long Gs = 0, Bs = 0;
    int K;
    scanf("%d", &K);
    K *= 2;
    for (int i = 1; i <= K; i++) {
      G[i].clear();
      sub[i] = D[i] = pc[i] = 0;
    }
    for (int i = 0; i < K - 1; i++) {
      int u, v, c;
      scanf("%d%d%d", &u, &v, &c);
      G[u].push_back({v, c});
      G[v].push_back({u, c});
      Gs += c;
    }
    dfs(1, 1, 0);
    int rt = cent(1);
    dfs(rt, rt, 0);
    for (int i = 1; i <= K; i++) {
      if (i != rt && sub[i] % 2 == 0) Gs -= pc[i];
      Bs += D[i];
    }
    printf("%lld %lld\n", Gs, Bs);
  }
  return 0;
}
