#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 5;
vector<pair<long long, long long>> G[maxn] = {};
long long ansmin, ansmax;
long long n;
long long size[maxn] = {};
bool vis[maxn] = {};
void dfs(long long x) {
  size[x] = 1;
  for (auto y : G[x]) {
    if (vis[y.first] == 1) continue;
    vis[y.first] = 1;
    dfs(y.first);
    size[x] += size[y.first];
    if (size[y.first] % 2) {
      ansmin += y.second;
    }
    long long r = min(size[y.first], 2 * n - size[y.first]);
    ansmax += r * y.second;
  }
}
signed main() {
  long long q;
  cin >> q;
  while (q--) {
    cin >> n;
    ansmax = 0;
    ansmin = 0;
    for (long long i = 1; i <= 2 * n; i++) {
      size[i] = 0;
      G[i].clear();
      vis[i] = 0;
    }
    long long p = 2 * n - 1;
    while (p--) {
      pair<long long, long long> temp;
      long long x, y;
      cin >> x >> y >> temp.second;
      temp.first = x;
      G[y].push_back(temp);
      temp.first = y;
      G[x].push_back(temp);
    }
    dfs(1);
    cout << ansmin << ' ' << ansmax << endl;
  }
  return 0;
}
