#include <bits/stdc++.h>
using namespace std;
const int K = 2e5 + 5;
long long k;
pair<long long, long long> dfs(int u, int p,
                               vector<pair<long long, long long> > g[],
                               vector<int> &z) {
  long long n = 1;
  long long s = 0;
  for (auto vt : g[u]) {
    int v;
    int t;
    tie(v, t) = vt;
    if (v != p) {
      long long nn, ss;
      tie(nn, ss) = dfs(v, u, g, z);
      if (nn % 2 == 0) {
        z.push_back(t);
      }
      n += nn;
      long long rest = 2 * k - nn;
      s += ss;
      s += min(rest, nn) * t;
    }
  }
  return pair<long long, long long>(n, s);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> k;
    vector<pair<long long, long long> > g[K];
    long long good = 0;
    for (int i = 0; i < 2 * k - 1; i++) {
      int u, v, t;
      cin >> u >> v >> t;
      u--;
      v--;
      g[u].push_back(pair<long long, long long>(v, t));
      g[v].push_back(pair<long long, long long>(u, t));
      good += t;
    }
    vector<int> z;
    pair<long long, long long> res = dfs(0, -1, g, z);
    sort(z.begin(), z.end(), greater<int>());
    for (int i = 0; i < z.size() && i < k; i++) {
      good -= z[i];
    }
    cout << good << ' ' << res.second << endl;
  }
  return 0;
}
