#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
vector<pair<int, int> > g[maxn];
long long G, B;
int n;
int dfs0(int u, int fa) {
  int sz = 1;
  for (auto e : g[u]) {
    if (e.first == fa) continue;
    int x = dfs0(e.first, u);
    B += 1LL * min(x, n - x) * e.second;
    sz += x;
  }
  return sz;
}
int dfs1(int u, int fa) {
  int sz = 1;
  for (auto e : g[u]) {
    if (e.first == fa) continue;
    int x = dfs1(e.first, u);
    if (x) G += e.second;
    sz += x;
  }
  return sz & 1;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int u, v, w;
    scanf("%d", &n);
    n *= 2;
    G = B = 0;
    for (int i = 1; i <= n; ++i) g[i].clear();
    for (int i = 1; i < n; ++i) {
      scanf("%d%d%d", &u, &v, &w);
      g[u].push_back(pair<int, int>(v, w));
      g[v].push_back(pair<int, int>(u, w));
    }
    dfs0(1, 0);
    dfs1(1, 0);
    printf("%lld %lld\n", G, B);
  };
  return 0;
}
