#include <bits/stdc++.h>
using namespace std;
int k = 1;
int t;
struct Edge {
  int to, next;
  long long value;
} edges[400100];
int ihead[200010], ecnt;
int xia[200010];
int l, r;
long long z;
void addEdge(int u, int v, long long value) {
  edges[++ecnt].to = v;
  edges[ecnt].value = value;
  edges[ecnt].next = ihead[u];
  ihead[u] = ecnt;
}
void dfs(int x, int fa) {
  xia[x] = 1;
  for (int i = ihead[x]; i; i = edges[i].next) {
    if (edges[i].to == fa) {
      continue;
    }
    dfs(edges[i].to, x);
    xia[x] += xia[edges[i].to];
  }
}
long long dp[200010];
void dfs2(int x, int fa) {
  dp[x] = 0;
  for (int i = ihead[x]; i; i = edges[i].next) {
    if (edges[i].to == fa) {
      continue;
    }
    dfs2(edges[i].to, x);
    if (xia[edges[i].to] % 2 == 0) {
      dp[x] += dp[edges[i].to];
    } else {
      dp[x] = dp[x] + dp[edges[i].to] + edges[i].value;
    }
  }
}
void dfs3(int x, int fa) {
  dp[x] = 0;
  for (int i = ihead[x]; i; i = edges[i].next) {
    if (edges[i].to == fa) {
      continue;
    }
    dfs3(edges[i].to, x);
    int mi = min(xia[edges[i].to], 2 * k - xia[edges[i].to]);
    dp[x] += 1ll * mi * edges[i].value;
    dp[x] += dp[edges[i].to];
  }
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &k);
    ecnt = 0;
    for (int i = 0; i <= 2 * k + 1; i++) {
      ihead[i] = 0;
      xia[i] = 0;
    }
    for (int i = 0; i <= 4 * k + 10; i++) {
      edges[i].to = edges[i].next = edges[i].value = 0;
    }
    for (int i = 1; i < 2 * k; ++i) {
      scanf("%d%d%d", &l, &r, &z);
      addEdge(l, r, z);
      addEdge(r, l, z);
    }
    dfs(1, 0);
    dfs2(1, 0);
    printf("%lld ", dp[1]);
    dfs3(1, 0);
    printf("%lld\n", dp[1]);
  }
}
