#include <bits/stdc++.h>
using namespace std;
long long T, t, n, ans, x, y, w, h[1100000], s[1100000];
struct edge {
  long long to, w, nxt;
} e[2000010];
void add(long long x, long long y, long long w) {
  ++t;
  e[t].to = y, e[t].w = w;
  e[t].nxt = h[x], h[x] = t;
}
void dfs1(long long x, long long fa = 0) {
  s[x] = 1;
  for (long long i = h[x]; i; i = e[i].nxt) {
    long long y = e[i].to;
    if (y == fa) continue;
    dfs1(y, x);
    s[x] += s[y];
    if (s[y] % 2) ans += e[i].w;
  }
}
void dfs2(long long x, long long fa = 0) {
  for (long long i = h[x]; i; i = e[i].nxt) {
    long long y = e[i].to;
    if (y == fa) continue;
    dfs2(y, x);
    ans += min(s[y], n - s[y]) * e[i].w;
  }
}
signed main() {
  cin >> T;
  while (T--) {
    cin >> n;
    n *= 2;
    for (long long i = 1; i < n; i++)
      scanf("%d%d%d", &x, &y, &w), add(x, y, w), add(y, x, w);
    ans = 0;
    dfs1(1);
    cout << ans << " ";
    ans = 0;
    dfs2(1);
    cout << ans << endl;
    for (long long i = 1; i <= n; i++) h[i] = 0, s[i] = 0;
    t = 0;
  }
  return 0;
}
