#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
inline long long fpow(long long n, long long k, long long p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = (n % p) * (n % p) % p;
  }
  return r;
}
inline long long inv(long long a, long long p = MOD) {
  return fpow(a, p - 2, p);
}
inline long long addmod(long long a, long long val, long long p = MOD) {
  {
    if ((a = (a + val)) >= p) a -= p;
  }
  return a;
}
inline long long submod(long long a, long long val, long long p = MOD) {
  {
    if ((a = (a - val)) < 0) a += p;
  }
  return a;
}
inline long long mult(long long a, long long b, long long p = MOD) {
  return (long long)a * b % p;
}
int main() {
  long long i, j, n, m, k, l, t, x, y, z;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<long long> count(2 * n, 1);
    l = 2 * n;
    vector<vector<pair<long long, long long> > > v(l);
    vector<long long> cost(l, 0);
    vector<long long> a(1, 0);
    vector<long long> parent(l, -1);
    parent[0] = 0;
    for (i = 0; i < l - 1; i++) {
      cin >> x >> y >> z;
      v[--x].push_back({--y, z});
      v[y].push_back({x, z});
    }
    for (i = 0; i < a.size(); i++) {
      x = a[i];
      for (j = 0; j < v[x].size(); j++) {
        y = v[x][j].first;
        z = v[x][j].second;
        if (parent[y] == -1) {
          parent[y] = x;
          cost[y] = z;
          a.push_back(y);
        }
      }
    }
    m = 0;
    k = 0;
    reverse(a.begin(), a.end());
    for (i = 0; i < a.size(); i++) {
      j = a[i];
      count[parent[j]] += count[j];
      m += cost[j] * min(count[j], l - count[j]);
      k += cost[j] * (count[j] % 2);
    }
    cout << k << " " << m << '\n';
  }
}
