#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
struct EDGE {
  long long v, w, nxt;
} e[400040];
long long tot = 0, head[200020], sz[200020], k;
long long sum1, sum2;
void add(long long u, long long v, long long w) {
  e[++tot].v = v;
  e[tot].w = w;
  e[tot].nxt = head[u];
  head[u] = tot;
}
void dfs1(long long u, long long fa = 0) {
  sz[u] = 1;
  for (long long i = head[u]; i; i = e[i].nxt) {
    long long v = e[i].v;
    if (v == fa) continue;
    dfs1(v, u);
    sz[u] += sz[v];
    if (sz[v] % 2 == 1) sum1 += e[i].w;
  }
}
void dfs2(long long u, long long fa = 0) {
  for (long long i = head[u]; i; i = e[i].nxt) {
    long long v = e[i].v;
    if (v == fa) continue;
    dfs2(v, u);
    sum2 += min(sz[v], k * 2 - sz[v]) * e[i].w;
  }
}
int main() {
  long long t;
  scanf("%lld", &t);
  while (t--) {
    for (long long i = 0; i <= k * 2; i++) {
      sz[i] = 0;
      head[i] = 0;
    }
    tot = 0;
    scanf("%lld", &k);
    for (long long i = 0; i < k * 2 - 1; i++) {
      long long u, v, w;
      scanf("%lld%lld%lld", &u, &v, &w);
      add(u, v, w);
      add(v, u, w);
    }
    sum1 = 0, sum2 = 0;
    dfs1(1);
    dfs2(1);
    printf("%lld %lld\n", sum1, sum2);
  }
}
