#include <bits/stdc++.h>
using namespace std;
constexpr int MAXK = 100000;
vector<pair<int, int>> adj[MAXK * 2 + 2];
int cost[MAXK * 2 + 2], sz[MAXK * 2 + 2];
int dfs(int u, int w) {
  sz[u] = 1;
  for (pair<int, int> vc : adj[u]) {
    int v = vc.first, c = vc.second;
    if (v == w) continue;
    cost[v] = c;
    sz[u] += dfs(v, u);
  }
  return sz[u];
}
int main() {
  int t;
  cin >> t;
  do {
    int k;
    cin >> k;
    int n = 2 * k;
    for (int i = 1; i <= n; i++) adj[i].clear();
    for (int i = 0; i < n - 1; i++) {
      int u, v, w;
      cin >> u >> v >> w;
      adj[u].push_back({v, w});
      adj[v].push_back({u, w});
    }
    dfs(1, 0);
    long long ansg = 0, ansb = 0;
    for (int i = 2; i <= n; i++) {
      if (sz[i] & 1) ansg += cost[i];
      ansb += (long long)min(sz[i], n - sz[i]) * cost[i];
    }
    cout << ansg << ' ' << ansb << '\n';
  } while (--t);
}
