#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 6;
long long int k, c[N];
vector<vector<pair<long long int, long long int> > > adj(N);
long long int g, b;
void dfs(long long int u, long long int p) {
  c[u] = 1;
  for (auto it : adj[u]) {
    long long int v = it.first, w = it.second;
    if (v == p) continue;
    dfs(v, u);
    c[u] += c[v];
    g += w * (c[v] % 2);
    b += w * min(c[v], 2 * k - c[v]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tt;
  cin >> tt;
  while (tt--) {
    cin >> k;
    g = 0;
    b = 0;
    for (int i = 0; i <= 2 * k; i++) {
      adj[i].clear();
      c[i] = 0;
    }
    for (int i = 1; i < 2 * k; i++) {
      long long int u, v, w;
      cin >> u >> v >> w;
      adj[u].push_back({v, w});
      adj[v].push_back({u, w});
    }
    dfs(1, 0);
    cout << g << " " << b << "\n";
  }
  return 0;
}
