#include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > G;
vector<vector<long long> > W;
vector<bool> vis;
long long n;
long long dfs(long long root, long long &ans1, long long &ans2) {
  vis[root] = true;
  long long sub = 1;
  for (long long i = 0; i < G[root].size(); i++) {
    long long v = G[root][i];
    if (!vis[v]) {
      long long t = dfs(v, ans1, ans2);
      sub += t;
      if (t % 2 == 1) ans1 += W[root][i];
      ans2 += min(t, n - t) * W[root][i];
    }
  }
  return sub;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long k, i, j, x, y, w;
    cin >> k;
    n = 2 * k;
    G.resize(n);
    W.resize(n);
    vis.resize(n);
    for (i = 0; i < n - 1; i++) {
      cin >> x >> y >> w;
      x--, y--;
      G[x].push_back(y);
      G[y].push_back(x);
      W[x].push_back(w);
      W[y].push_back(w);
    }
    long long ans1 = 0, ans2 = 0;
    dfs(0, ans1, ans2);
    cout << ans1 << " " << ans2 << endl;
    G.clear();
    W.clear();
    vis.clear();
  }
}
