#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> v[200200];
long long xd[200200];
long long k, k2, a, b, c, p, gol, mol;
bool used[200200];
void dfs(long long pos) {
  ++p;
  used[pos] = 1;
  xd[pos] = p;
  for (int i = 0; i < v[pos].size(); ++i) {
    if (!used[v[pos][i].first]) {
      dfs(v[pos][i].first);
      gol += min(xd[v[pos][i].first] + 1, k2 - xd[v[pos][i].first] - 1) *
             v[pos][i].second;
      mol += ((xd[v[pos][i].first] + 1) % 2) * v[pos][i].second;
    }
  }
  xd[pos] = p - xd[pos];
}
int main() {
  long long t;
  cin >> t;
  while (t-- > 0) {
    cin >> k;
    k2 = k * 2;
    for (int i = 1; i <= k2; ++i) v[i].clear();
    memset(used, 0, sizeof(used));
    p = 0;
    gol = 0;
    mol = 0;
    for (int i = 1; i < k2; ++i) {
      cin >> a >> b >> c;
      v[a].push_back(make_pair(b, c));
      v[b].push_back(make_pair(a, c));
    }
    dfs(1);
    cout << mol << " " << gol << endl;
  }
  return 0;
}
