#include <bits/stdc++.h>
using ll = long long;
using namespace std;
long long dfs_gb(long long v, long long p, long long &sm_g, long long &sm_b,
                 long long n, vector<vector<pair<long long, long long>>> &g) {
  long long sz = 1;
  for (auto pr : g[v]) {
    long long u = pr.first, w = pr.second;
    if (u != p) {
      long long szu = dfs_gb(u, v, sm_g, sm_b, n, g);
      sz += szu;
      sm_b += w * min(szu, n - szu);
      if (szu % 2 == 1) {
        sm_g += w;
      }
    }
  }
  return sz;
}
void sol() {
  long long k, a, b, c;
  cin >> k;
  vector<vector<pair<long long, long long>>> g(2 * k + 1);
  for (long long i = 0; i < 2 * k - 1; i++) {
    cin >> a >> b >> c;
    g[a].emplace_back(b, c);
    g[b].emplace_back(a, c);
  }
  long long sm_g = 0, sm_b = 0;
  dfs_gb(1, 1, sm_g, sm_b, 2 * k, g);
  cout << sm_g << " " << sm_b << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    sol();
  }
}
