#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 2e5 + 5;
long long Ma, Mi, n, First[Maxn], Next[2 * Maxn], to[Maxn * 2], cnt,
    wei[Maxn * 2], size[Maxn];
inline void init() {
  Ma = Mi = cnt = 0;
  memset(First, 0, sizeof(long long) * (n + 2));
}
inline void add(long long z, long long y, long long w) {
  Next[++cnt] = First[z];
  First[z] = cnt;
  to[cnt] = y;
  wei[cnt] = w;
}
inline long long R() {
  char c;
  long long res;
  while ((c = getchar()) > '9' || c < '0')
    ;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') res = res * 10 + c - '0';
  return res;
}
void deal(long long pos, long long father) {
  size[pos] = 1;
  for (long long k = First[pos]; k; k = Next[k]) {
    if (to[k] == father) continue;
    deal(to[k], pos);
    Mi += wei[k];
    size[pos] += size[to[k]];
  }
}
void dfs(long long pos, long long father) {
  for (long long k = First[pos]; k; k = Next[k]) {
    if (to[k] == father) continue;
    if (size[to[k]] % 2 == 0) Mi -= wei[k];
    Ma += min(size[to[k]], n - size[to[k]]) * wei[k];
    dfs(to[k], pos);
  }
}
signed main() {
  long long t = R();
  long long x, y, w;
  while (t--) {
    n = R();
    n *= 2;
    init();
    for (long long i = 1; i < n; i++) {
      x = R();
      y = R();
      w = R();
      add(x, y, w);
      add(y, x, w);
    }
    deal(1, 0);
    dfs(1, 0);
    printf("%lld %lld\n", Mi, Ma);
  }
}
