#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> G(200001);
vector<pair<pair<long long, long long>, long long>> E;
long long dp[200001];
bool visited[200001];
void dfs(long long root) {
  visited[root] = 1;
  vector<long long> next;
  for (auto i : G[root]) {
    if (visited[i]) {
      continue;
    }
    next.push_back(i);
  }
  if (next.size() == 0) {
    dp[root] = 1;
  } else {
    long long sum = 1;
    for (auto i : next) {
      dfs(i);
      sum += dp[i];
    }
    dp[root] = sum;
  }
}
void sub() {
  long long k;
  cin >> k;
  E.clear();
  for (long long i = 1; i <= 2 * k; i++) {
    visited[i] = 0;
    G[i].clear();
  }
  for (long long i = 0; i < 2 * k - 1; i++) {
    long long v1, v2, w;
    cin >> v1 >> v2 >> w;
    G[v1].push_back(v2);
    G[v2].push_back(v1);
    E.push_back({{v1, v2}, w});
  }
  long long root = 1;
  dfs(root);
  long long ans1 = 0, ans2 = 0;
  for (auto i : E) {
    long long _min = min(dp[i.first.first], dp[i.first.second]);
    if (_min % 2) {
      ans1 += i.second;
    }
    ans2 += min(_min, 2 * k - _min) * i.second;
  }
  cout << ans1 << ' ' << ans2 << endl;
}
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    sub();
  }
}
