#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 5;
vector<pair<int, int> > gr[N];
int sz[N];
bool dfs_min(int v, int p, long long& ans) {
  bool ok = false;
  for (auto pr : gr[v]) {
    int u = pr.first;
    if (u == p) continue;
    if (!dfs_min(u, v, ans)) ans += pr.second, ok ^= true;
  }
  return ok;
}
int dfs_sz(int v, int p) {
  sz[v] = 1;
  for (auto pr : gr[v]) {
    int u = pr.first;
    if (u == p) continue;
    sz[v] += dfs_sz(u, v);
  }
  return sz[v];
}
long long dfs_max(int v, int p, long long d) {
  long long res = d;
  for (auto pr : gr[v]) {
    int u = pr.first;
    if (u == p) continue;
    res += dfs_max(u, v, d + pr.second);
  }
  return res;
}
void solve() {
  int n;
  scanf("%d", &n);
  n *= 2;
  for (int i = 0; i < n; ++i) gr[i].clear();
  for (int i = 1; i < n; ++i) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    --u;
    --v;
    gr[u].push_back({v, w});
    gr[v].push_back({u, w});
  }
  long long ans_min = 0;
  dfs_min(0, -1, ans_min);
  printf("%lld ", ans_min);
  dfs_sz(0, -1);
  int r = 0;
  for (int v = 1; v < n; ++v) {
    bool ok = true;
    for (auto pr : gr[v])
      if (sz[pr.first] < sz[v]) ok &= sz[pr.first] <= n / 2;
    ok &= n - sz[v] <= n / 2;
    if (ok) {
      r = v;
      break;
    }
  }
  printf("%lld\n", dfs_max(r, -1, 0));
}
int main() {
  int test;
  scanf("%d", &test);
  while (test--) solve();
}
