#include <bits/stdc++.h>
using namespace std;
void read(long long &x) {
  char ch = getchar();
  x = 0;
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar();
}
const long long N = 2e5 + 5, M = N << 1;
long long n, mn, mx, sz[N];
long long cnt, h[N], nxt[M], to[M], l[M];
void add(long long u, long long v, long long ll) {
  to[++cnt] = v, l[cnt] = ll, nxt[cnt] = h[u], h[u] = cnt;
  to[++cnt] = u, l[cnt] = ll, nxt[cnt] = h[v], h[v] = cnt;
}
void dfs(long long u, long long la) {
  sz[u] = 1;
  for (long long i = h[u], v; i; i = nxt[i]) {
    if ((v = to[i]) == la) continue;
    dfs(v, u);
    sz[u] += sz[v];
    mx += min(sz[v], n - sz[v]) * l[i];
    mn += (sz[v] & 1) * l[i];
  }
}
signed main() {
  long long T;
  read(T);
  while (T--) {
    read(n);
    n *= 2;
    cnt = 0;
    for (long long i = 1; i <= n; ++i) h[i] = 0;
    for (long long i = 1, u, v, l; i < n; ++i)
      read(u), read(v), read(l), add(u, v, l);
    mn = mx = 0, dfs(1, 0);
    printf("%lld %lld\n", mn, mx);
  }
  return 0;
}
