#include <bits/stdc++.h>
using namespace std;
int T, N;
int q[200005], Head, Tail, vis[200005], childs[200005];
long long dp[200005][2];
struct E {
  int e, val;
  bool child;
};
vector<E> edge[200005];
int main() {
  long long big_num = 99999999;
  big_num *= big_num;
  big_num += big_num;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &N);
    N <<= 1;
    long long bad_ans = 0;
    long long good_ans = 0;
    for (int i = 1; i <= N; i++) {
      edge[i].clear();
      vis[i] = childs[i] = 0;
      dp[i][0] = dp[i][1] = big_num;
    }
    for (int i = 1; i < N; i++) {
      int a, b, c;
      scanf("%d %d %d", &a, &b, &c);
      edge[a].push_back((E){b, c, false});
      edge[b].push_back((E){a, c, false});
    }
    Head = Tail = 0;
    q[Tail++] = 1;
    vis[1] = 1;
    while (Head != Tail) {
      int cur = q[Head++];
      for (auto it = edge[cur].begin(); it != edge[cur].end(); it++) {
        if (vis[it->e]) continue;
        vis[it->e] = 1;
        q[Tail++] = it->e;
        it->child = true;
      }
    }
    for (int i = Head - 1; i >= 0; i--) {
      int cur = q[i];
      for (auto it = edge[cur].begin(); it != edge[cur].end(); it++) {
        if (!it->child) continue;
        int p = childs[it->e];
        if (p > N - p) p = N - p;
        bad_ans += (long long)it->val * p;
        childs[cur] += childs[it->e];
        if (childs[it->e] % 2 == 1) good_ans += (long long)it->val;
      }
      childs[cur]++;
    }
    printf("%lld %lld\n", good_ans, bad_ans);
  }
  return 0;
}
