#include <bits/stdc++.h>
using namespace std;
struct Solution {
  static const int man = 600807;
  int t, k;
  unsigned long long ans[2];
  vector<vector<pair<int, int> > > g;
  vector<int> sz;
  inline void reset() {
    ans[0] = ans[1] = 0ull;
    sz.clear();
    for (int i = 0; i < g.size(); ++i) {
      g[i].clear();
    }
  }
  inline void init() {
    for (int i = 1; i < 2 * k; ++i) {
      int a, b, w;
      scanf("%d %d %d", &a, &b, &w);
      g[a].push_back(make_pair(b, w));
      g[b].push_back(make_pair(a, w));
    }
  }
  inline void dfs(int x, int p) {
    sz[x] = 1;
    for (vector<pair<int, int> >::iterator it = g[x].begin(); it != g[x].end();
         ++it) {
      pair<int, int> tmp = *it;
      if (tmp.first == p) continue;
      dfs(tmp.first, x);
      sz[x] += sz[tmp.first];
      if (sz[tmp.first] % 2) ans[0] += 1ll * tmp.second;
      ans[1] += 1ll * min((k << 1) - sz[tmp.first], sz[tmp.first]) * tmp.second;
    }
  }
  inline void solve() {
    init();
    dfs(1, -1);
    cout << ans[0] << " " << ans[1] << endl;
  }
  inline void Solve() {
    scanf("%d", &t);
    while (t--) {
      reset();
      scanf("%d", &k);
      g.resize(2 * k + 1);
      sz.resize(2 * k + 1);
      solve();
    }
  }
} CF607E;
signed main() {
  CF607E.Solve();
  return 0;
}
