#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> v[200009];
long long vis[200009] = {0};
long long n;
long long ans = 0;
long long dfs1(long long start, int par) {
  vis[start] = 1;
  long long res = 0;
  for (auto i : v[start]) {
    if (i.first == par)
      continue;
    else {
      if (!vis[i.first]) {
        long long cnt = dfs1(i.first, start);
        ans += (cnt % 2 * i.second);
        res += cnt;
      }
    }
  }
  return 1 + res;
}
long long dfs(long long start, int parent) {
  vis[start] = 1;
  long long res = 0;
  for (auto i : v[start]) {
    if (i.first == parent) continue;
    if (!vis[i.first]) {
      long long cnt = dfs(i.first, start);
      res += cnt;
      ans += (min(cnt, 2 * n - cnt) * i.second);
    }
  }
  return 1 + res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    long long x, y, u;
    for (int i = 1; i <= 2 * n - 1; i++) {
      cin >> x >> y >> u;
      v[x].push_back(make_pair(y, u));
      v[y].push_back(make_pair(x, u));
    }
    long long res;
    dfs1(1, -1);
    cout << ans << " ";
    for (int i = 1; i <= 2 * n; i++) vis[i] = 0;
    ans = 0;
    dfs(1, -1);
    cout << ans << endl;
    for (int i = 1; i <= 2 * n; i++) {
      v[i].clear();
      vis[i] = 0;
      ans = 0;
    }
  }
  return 0;
}
