#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long LLINF = 1e18 + 7;
int visited1[200009];
int visited2[200009];
int visited3[200009];
int siz[200009];
int siz2[200009];
vector<vector<pair<int, int>>> nbs(200009);
int cnt = 1;
int centroid;
int k;
long long ans1 = 0;
long long ans2 = 0;
int dfs2(int v) {
  visited2[v] = cnt++;
  for (auto idx : nbs[v]) {
    if (!visited2[idx.first]) {
      dfs2(idx.first);
    }
  }
  siz2[v] = cnt - visited2[v];
  return siz2[v];
}
void dfs3(int v) {
  visited3[v] = 1;
  for (auto idx : nbs[v]) {
    if (!visited3[idx.first]) {
      ans2 += idx.second * (long long)siz2[idx.first];
      dfs3(idx.first);
    }
  }
}
int dfs_size(int v) {
  visited1[v] = cnt++;
  int maxx = 1;
  for (auto idx : nbs[v]) {
    if (!visited1[idx.first]) {
      maxx = max(maxx, dfs_size(idx.first));
      if (siz[idx.first] & 1) {
        ans1 += idx.second;
      }
    }
  }
  siz[v] = cnt - visited1[v];
  maxx = max(maxx, 2 * k - siz[v]);
  if (maxx <= k) {
    centroid = v;
  }
  return siz[v];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ;
  int t;
  cin >> t;
  while (t--) {
    cin >> k;
    int a, b, w;
    ans1 = ans2 = 0;
    for (int i = 1; i <= 2 * k; i++) {
      nbs[i].clear();
      visited1[i] = 0;
      visited2[i] = 0;
      visited3[i] = 0;
      siz[i] = 0;
      siz2[i] = 0;
    }
    for (int i = 1; i < 2 * k; i++) {
      cin >> a >> b >> w;
      nbs[a].push_back({b, w});
      nbs[b].push_back({a, w});
    }
    cnt = 1;
    dfs_size(1);
    cnt = 1;
    dfs2(centroid);
    cnt = 1;
    dfs3(centroid);
    cout << ans1 << " " << ans2 << '\n';
  }
}
