#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
struct edge {
  int y, nxt, z;
} e[N * 2];
int p[N], sz[N];
int eid, k;
long long mn, mx;
bool v[N];
void add(int x, int y, int z) {
  e[eid] = edge{y, p[x], z};
  p[x] = eid++;
}
void dfs(int x) {
  v[x] = sz[x] = 1;
  for (int i = p[x]; ~i; i = e[i].nxt) {
    int y = e[i].y;
    if (v[y]) continue;
    dfs(y);
    if (sz[y] % 2 == 0) mn -= e[i].z;
    mx += 1LL * e[i].z * min(sz[y], 2 * k - sz[y]);
    sz[x] += sz[y];
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &k);
    mn = mx = eid = 0;
    memset(p, -1, sizeof(p));
    memset(v, 0, sizeof(v));
    for (int i = 1; i < 2 * k; ++i) {
      int x, y, z;
      scanf("%d%d%d", &x, &y, &z);
      add(x, y, z);
      add(y, x, z);
      mn += z;
    }
    dfs(1);
    printf("%lld %lld\n", mn, mx);
  }
  return 0;
}
