#include <bits/stdc++.h>
using namespace std;
long long t, n, sr[200005], min_, max_;
vector<pair<long long, long long> > vr[200005];
void dfs(long long, long long), func(long long, long long);
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i < 2 * n + 1; i++) vr[i].clear();
    for (int i = 0; i < 2 * n - 1; i++) {
      long long x, y, z;
      cin >> x >> y >> z;
      vr[x].push_back(make_pair(y, z));
      vr[y].push_back(make_pair(x, z));
    }
    dfs(1, 0);
    func(1, 0);
    cout << min_ << " " << max_ << "\n";
    min_ = max_ = 0;
  }
}
void dfs(long long idx, long long p) {
  long long size_ = vr[idx].size();
  sr[idx] = 1;
  for (int i = 0; i < size_; i++) {
    if (vr[idx][i].first == p) continue;
    dfs(vr[idx][i].first, idx);
    sr[idx] += sr[vr[idx][i].first];
  }
}
void func(long long idx, long long par) {
  long long size_ = vr[idx].size();
  for (int i = 0; i < size_; i++) {
    pair<long long, long long> p = vr[idx][i];
    if (p.first == par) continue;
    func(p.first, idx);
    max_ += (p.second * min(sr[p.first], 2 * n - sr[p.first]));
    min_ += p.second * (sr[p.first] % 2);
  }
}
