#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int n, T, head[maxn], cnt, num[maxn];
long long maxx, minn;
struct node {
  int y, len, next;
} a[maxn << 1];
void add(int x, int y, int z) {
  a[cnt].y = y;
  a[cnt].len = z;
  a[cnt].next = head[x];
  head[x] = cnt++;
}
void dfs(int u, int fa) {
  num[u] = 1;
  for (int i = head[u]; i != -1; i = a[i].next) {
    int v = a[i].y;
    if (v == fa) continue;
    dfs(v, u);
    if (num[v] & 1) minn += a[i].len;
    maxx += (long long)min(n - num[v], num[v]) * a[i].len;
    num[u] += num[v];
  }
}
int main() {
  scanf("%d", &T);
  while (T--) {
    cnt = 0;
    memset(head, -1, sizeof(head));
    memset(num, 0, sizeof(num));
    scanf("%d", &n);
    n <<= 1;
    for (int i = 1; i < n; ++i) {
      int u, v, w;
      scanf("%d %d %d", &u, &v, &w);
      add(u, v, w);
      add(v, u, w);
    }
    maxx = 0, minn = 0;
    dfs(1, 0);
    printf("%lld %lld\n", minn, maxx);
  }
}
