#include <bits/stdc++.h>
using namespace std;
const long long maxn = 200010;
vector<long long> adjlist[maxn];
long long sze[maxn];
long long depth[maxn];
long long dfs(long long x, long long p) {
  sze[x] = 1;
  for (auto i : adjlist[x]) {
    if (i == p) continue;
    depth[i] = depth[x] + 1;
    sze[x] += dfs(i, x);
  }
  return sze[x];
}
void solve() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= 2 * n; i++) adjlist[i].clear();
  memset(sze, 0, sizeof sze);
  vector<pair<pair<long long, long long>, long long> > edges;
  edges.clear();
  for (long long i = 0; i < n * 2 - 1; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    adjlist[a].push_back(b);
    adjlist[b].push_back(a);
    edges.push_back(pair<pair<long long, long long>, long long>(
        pair<long long, long long>(a, b), c));
  }
  dfs(1, 0);
  long long ansmin = 0, ansmax = 0;
  for (auto cur : edges) {
    long long a = cur.first.first, b = cur.first.second;
    if (depth[a] < depth[b]) swap(a, b);
    if (sze[a] % 2 != 0) {
      ansmin += cur.second;
    }
  }
  for (auto cur : edges) {
    long long a = cur.first.first, b = cur.first.second;
    if (depth[a] < depth[b]) swap(a, b);
    long long no = min(sze[a], n * 2 - sze[a]);
    ansmax += no * cur.second;
  }
  cout << ansmin << " " << ansmax << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long tc;
  cin >> tc;
  while (tc--) solve();
}
