#include <bits/stdc++.h>
using namespace std;
long long t, k, cnt[300005], mini, maxi;
vector<pair<long long, long long> > v[300005];
vector<bool> vis;
void dfs(long long st, long long pr) {
  cnt[st] = 1;
  for (auto i : v[st]) {
    if (i.second != pr) {
      dfs(i.second, st);
      cnt[st] += cnt[i.second];
    }
  }
  long long c = 0, sum = 0;
  for (auto i : v[st]) {
    if (i.second != pr) {
      if (vis[i.second] == false) {
        c++;
        sum += i.first;
      }
      maxi += i.first * min(cnt[i.second], k - cnt[i.second]);
    }
  }
  mini += sum;
  if (c % 2 == 1) vis[st] = true;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    cin >> k;
    k *= 2;
    vis.resize(k + 5, false);
    for (long long i = 1; i < k; ++i) {
      long long x, y, w;
      cin >> x >> y >> w;
      v[x].push_back({w, y});
      v[y].push_back({w, x});
    }
    dfs(1, 0);
    cout << mini << " " << maxi << "\n";
    for (long long i = 1; i <= k; ++i) v[i].clear(), cnt[i] = 0;
    vis.clear();
    mini = 0;
    maxi = 0;
  }
  return 0;
}
