#include <bits/stdc++.h>
using namespace std;
int T, n, k;
vector<pair<int, int> > G[200005];
int sz[200005];
int C;
inline void findC(int u, int pa) {
  sz[u] = 1;
  bool good = 1;
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i].first;
    if (v != pa) {
      findC(v, u);
      sz[u] += sz[v];
      if (sz[v] > k) good = 0;
    }
  }
  if (n - sz[u] > k) good = 0;
  if (good) C = u;
  return;
}
inline long long dfsG(int u, int pa) {
  sz[u] = 1;
  long long ret = 0;
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i].first, w = G[u][i].second;
    if (v != pa) ret += dfsG(v, u) + ((sz[v] & 1) ? w : 0), sz[u] += sz[v];
  }
  return ret;
}
inline long long dfsB(int u, int pa) {
  sz[u] = 1;
  long long ret = 0;
  for (int i = 0; i < G[u].size(); ++i) {
    int v = G[u][i].first, w = G[u][i].second;
    if (v != pa) ret += dfsB(v, u) + (long long)sz[v] * w, sz[u] += sz[v];
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> T;
  while (T--) {
    cin >> k;
    n = k * 2;
    for (int i = 1; i <= n; ++i) G[i].clear();
    for (int i = 1; i <= n - 1; ++i) {
      int a, b, w;
      cin >> a >> b >> w;
      G[a].push_back(make_pair(b, w));
      G[b].push_back(make_pair(a, w));
    }
    findC(1, 0);
    cout << dfsG(C, 0) << ' ' << dfsB(C, 0) << endl;
  }
  return 0;
}
