#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  return x * neg;
}
struct Edge {
  long long v, w, nxt;
} e[200011 << 1 | 1];
long long cnt = 0, last[200011];
void adde(long long u, long long v, long long w) {
  ++cnt;
  e[cnt].v = v, e[cnt].w = w;
  e[cnt].nxt = last[u], last[u] = cnt;
}
long long n, ans, size[200011];
void dfs1(long long u, long long fa = 0) {
  size[u] = 1;
  for (long long i = last[u]; i; i = e[i].nxt) {
    long long v = e[i].v;
    if (v == fa) continue;
    dfs1(v, u);
    size[u] += size[v];
    if (size[v] & 1) ans += e[i].w;
  }
}
void dfs2(long long u, long long fa = 0) {
  for (long long i = last[u]; i; i = e[i].nxt) {
    long long v = e[i].v;
    if (v == fa) continue;
    dfs2(v, u);
    ans += min(size[v], n - size[v]) * e[i].w;
  }
}
int main() {
  long long task = read();
  while (task--) {
    n = read() << 1;
    for (long long i = 1; i < n; ++i) {
      long long u = read(), v = read(), w = read();
      adde(u, v, w), adde(v, u, w);
    }
    ans = 0;
    dfs1(1);
    printf("%lld ", ans);
    ans = 0;
    dfs2(1);
    printf("%lld\n", ans);
    for (long long i = 1; i <= n; ++i) last[i] = 0, size[i] = 0;
    cnt = 0;
  }
  return 0;
}
