#include <bits/stdc++.h>
using namespace std;
int T, k, te;
long long ans1, ans2;
int st[200010], sz[200010];
struct edge {
  int next;
  int to;
  int w;
} e[400010];
void adde(int x, int y, int z) {
  te++;
  e[te].next = st[x];
  st[x] = te;
  e[te].to = y;
  e[te].w = z;
}
void dfs(int x, int fa) {
  sz[x] = 1;
  for (int i = st[x]; i; i = e[i].next) {
    int to = e[i].to;
    if (to == fa) continue;
    dfs(to, x);
    sz[x] += sz[to];
  }
}
int main() {
  ios::sync_with_stdio(false);
  memset(st, 0, sizeof(st));
  int u, v, w;
  cin >> T;
  while (T--) {
    te = 0;
    cin >> k;
    k *= 2;
    for (int i = 1; i < k; i++) {
      cin >> u >> v >> w;
      adde(u, v, w);
      adde(v, u, w);
    }
    dfs(1, 0);
    ans1 = ans2 = 0;
    for (int i = 1; i <= te; i += 2) {
      int to = e[i].to;
      if (sz[e[i].to] > sz[e[i + 1].to]) to = e[i + 1].to;
      ans1 += 1ll * e[i].w * (sz[to] & 1);
      ans2 += 1ll * e[i].w * min(sz[to], k - sz[to]);
    }
    cout << ans1 << " " << ans2 << endl;
    for (int i = 1; i <= k; i++) st[i] = 0;
  }
  return 0;
}
