#include <bits/stdc++.h>
using namespace std;
function<void(void)> ____ = []() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
};
const int MAXN = 1e6 + 7;
int T, n, sz[MAXN];
vector<pair<int, int_fast64_t>> G[MAXN];
int_fast64_t maxx, minn;
void dfs(int u, int f) {
  sz[u] = 1;
  for (auto p : G[u]) {
    int v = p.first;
    if (v == f) continue;
    dfs(v, u);
    maxx += p.second * min(sz[v], 2 * n - sz[v]);
    if (sz[v] % 2 == 1 || (2 * n - sz[v]) % 2 == 1) minn += p.second;
    sz[u] += sz[v];
  }
}
int main() {
  ____();
  cin >> T;
  while (T--) {
    maxx = minn = 0;
    cin >> n;
    for (int i = 1; i <= n * 2; i++) G[i].clear();
    for (int i = 1; i < n * 2; i++) {
      int u, v, c;
      cin >> u >> v >> c;
      G[u].push_back(make_pair(v, c));
      G[v].push_back(make_pair(u, c));
    }
    dfs(1, 0);
    cout << minn << ' ' << maxx << endl;
  }
  return 0;
}
