#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 10;
vector<pair<long long, long long>> g[maxn];
long long rest = 0;
long long ans1 = 0, ans2 = 0;
bool dfs(long long v, long long p = -1) {
  long long cnt = 1;
  for (auto &[u, c] : g[v]) {
    if (u == p) continue;
    if (dfs(u, v)) {
      ans1 += c;
      cnt++;
    }
  }
  return (cnt & 1);
}
long long dfs2(long long v, long long p = -1) {
  long long cnt = 1;
  for (auto &[u, c] : g[v]) {
    if (u == p) continue;
    long long res = dfs2(u, v);
    ans2 += res * c;
    cnt += res;
  }
  long long mn = min(cnt, rest - cnt);
  rest -= (cnt - mn);
  return mn;
}
void solve() {
  long long k;
  cin >> k;
  rest = 2 * k;
  for (long long i = 0; i < 2 * k - 1; i++) {
    long long u, v, t;
    cin >> u >> v >> t;
    g[u].emplace_back(v, t);
    g[v].emplace_back(u, t);
  }
  dfs(1);
  dfs2(1);
  cout << ans1 << " " << ans2 << "\n";
  for (long long i = 1; i <= 2 * k; i++) {
    g[i].clear();
  }
  ans1 = 0, ans2 = 0;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
