#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 10;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
long long mark[MAXN], ansg = 0, ansb = 0, n;
vector<pair<long long, long long> > adj[MAXN];
pair<long long, long long> a[MAXN];
long long dfs(long long v) {
  long long cnt = 1;
  for (auto k : adj[v]) {
    long long u = k.first, num = k.second;
    if (!mark[u]) {
      mark[u] = 1;
      long long x = dfs(u);
      cnt += x;
      if (x % 2) {
        ansg += num;
      }
      ansb += min(x, n - x) * num;
    }
  }
  return cnt;
}
int main() {
  long long t;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> t;
  for (int i = 0; i < t; i++) {
    long long k;
    cin >> k;
    for (int j = 0; j < 2 * k - 1; j++) {
      long long u, v, x;
      cin >> u >> v >> x;
      adj[u].push_back(make_pair(v, x));
      adj[v].push_back(make_pair(u, x));
      a[j] = make_pair(v, u);
    }
    ansg = ansb = 0;
    n = 2 * k;
    memset(mark, 0, sizeof mark);
    mark[1] = 1;
    dfs(1);
    cout << ansg << " " << ansb << '\n';
    for (int j = 0; j < 2 * k - 1; j++) {
      adj[a[j].first].pop_back();
      adj[a[j].second].pop_back();
    }
  }
}
