#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> g[600001];
long long subs[600001];
long long G = 0;
long long B = 0;
long long k;
long long min_dfs(long long s, long long p) {
  long long cnt = 0;
  subs[s] = 1;
  for (auto it : g[s]) {
    long long w = it.second;
    long long child = it.first;
    if (child != p) {
      long long take = min_dfs(child, s);
      if (take) {
        G += w;
        cnt++;
      }
      subs[s] += subs[child];
      B += w * min(subs[child], 2 * k - subs[child]);
    }
  }
  return !(cnt & 1);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    cin >> k;
    for (long long i = 1; i <= 2 * k; i++) g[i].clear();
    for (long long i = 0; i < 2 * k - 1; i++) {
      long long a, b, c;
      cin >> a >> b >> c;
      g[a].push_back({b, c});
      g[b].push_back({a, c});
    }
    G = 0;
    B = 0;
    min_dfs(1, 1);
    cout << G << " " << B << "\n";
  }
  return 0;
}
