#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
vector<vector<pair<long long, long long> > > adj;
vector<long long> par, sz;
void dfs(long long u = 0, long long p = 0, long long w = 0) {
  par[u] = w;
  sz[u] = 1;
  for (auto &ele : adj[u]) {
    long long v = ele.first, ww = ele.second;
    if (v == p) continue;
    dfs(v, u, ww);
    sz[u] += sz[v];
  }
}
void solve() {
  long long n;
  cin >> n;
  n *= 2;
  adj.assign(n, vector<pair<long long, long long> >());
  for (long long i = 0; i < n - 1; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    a -= 1;
    b -= 1;
    adj[a].push_back({b, c});
    adj[b].push_back({a, c});
  }
  par.assign(n, -1);
  sz.assign(n, -1);
  dfs();
  long long mx = 0, mn = 0;
  for (long long u = 1; u < n; u++) {
    if (sz[u] & 1) mn += par[u];
    mx += min(sz[u], n - sz[u]) * par[u];
  }
  cout << mn << " " << mx << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) solve();
}
