#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 7;
long long n;
vector<pair<long long, long long>> g[N];
long long sz[N], ans1, ans2;
void dfs(long long v, long long pr = -1) {
  sz[v] = 1;
  for (auto e : g[v]) {
    if (e.first != pr) {
      dfs(e.first, v);
      sz[v] += sz[e.first];
      ans1 += (sz[e.first] & 1) * e.second;
      ans2 += min(sz[e.first], n - sz[e.first]) * e.second;
    }
  }
}
void solve() {
  long long k;
  cin >> k;
  n = 2 * k;
  for (long long i = 0; i < n - 1; i++) {
    long long v, u, t;
    cin >> v >> u >> t;
    v--;
    u--;
    g[v].push_back({u, t});
    g[u].push_back({v, t});
  }
  ans1 = 0;
  ans2 = 0;
  dfs(0);
  cout << ans1 << " " << ans2 << '\n';
  for (long long i = 0; i < n; i++) g[i].clear();
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
