#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
vector<pair<long long int, long long int>> edges[200010];
vector<pair<long long int, long long int>> children[200010];
void dfs1(long long int u, long long int p) {
  for (auto c : edges[u]) {
    if (c.first == p) continue;
    children[u].push_back(c);
    dfs1(c.first, u);
  }
}
long long int sub[200010];
long long int k;
long long int dsub(long long int u) {
  sub[u] = 1;
  for (auto c : children[u]) {
    sub[u] += dsub(c.first);
  }
  return sub[u];
}
long long int B, G;
void bad(long long int u) {
  for (auto c : children[u]) {
    long long int inn = sub[c.first];
    long long int out = 2 * k - inn;
    long long int Q = min(inn, out);
    B += Q * c.second;
    bad(c.first);
  }
}
bool good(long long int u) {
  long long int o = 0;
  for (auto c : children[u]) {
    if (!good(c.first)) {
      G += c.second;
      o++;
    }
  }
  return o % 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    cin >> k;
    B = 0;
    G = 0;
    for (long long int i = 1; i <= 2 * k; ++i) {
      edges[i].clear();
      children[i].clear();
    }
    for (long long int i = 0; i < 2 * k - 1; ++i) {
      long long int u, v, t;
      cin >> u >> v >> t;
      edges[u].push_back({v, t});
      edges[v].push_back({u, t});
    }
    dfs1(1, -1);
    dsub(1);
    bad(1);
    good(1);
    cout << G << " " << B << endl;
  }
}
