#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 2 * 1e5 + 15;
int n;
long long minsum, maxsum;
int head[MAXN], sz[MAXN];
struct EDGE {
  int next, v, w;
} e[2 * MAXN];
int ecnt;
void add_edge(int u, int v, int w) {
  e[ecnt].v = v;
  e[ecnt].w = w;
  e[ecnt].next = head[u];
  head[u] = ecnt++;
}
void dfs(int u, int fa) {
  sz[u] = 1;
  for (int i = head[u]; i != -1; i = e[i].next) {
    int v = e[i].v;
    if (v == fa) continue;
    dfs(v, u);
    sz[u] += sz[v];
    maxsum += 1ll * min(sz[v], n - sz[v]) * e[i].w;
    if (sz[v] & 1) minsum += 1ll * e[i].w;
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int k;
    scanf("%d", &k);
    n = 2 * k;
    minsum = maxsum = 0;
    ecnt = 0;
    for (int i = 0; i <= n; i++) head[i] = -1;
    for (int i = 1; i <= n - 1; i++) {
      int u, v, w;
      scanf("%d%d%d", &u, &v, &w);
      add_edge(u, v, w);
      add_edge(v, u, w);
    }
    dfs(1, 0);
    printf("%lld %lld\n", minsum, maxsum);
  }
  return 0;
}
