#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
const long long MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
int N;
long long mini, maxi;
int sz[MAXN];
vector<pair<int, int> > e[MAXN];
void dfs(int u, int fa) {
  int v, t;
  sz[u] = 1;
  for (int i = 0; i < e[u].size(); i++) {
    v = e[u][i].first;
    t = e[u][i].second;
    if (v == fa) {
      continue;
    }
    dfs(v, u);
    sz[u] += sz[v];
    if (sz[v] & 1) {
      mini += t;
    }
    maxi += (long long)min(sz[v], 2 * N - sz[v]) * t;
  }
}
int main() {
  int T;
  int u, v, t;
  while (~scanf("%d", &T)) {
    while (T--) {
      scanf("%d", &N);
      for (int i = 0; i <= 2 * N; i++) {
        e[i].clear();
      }
      for (int i = 0; i < 2 * N - 1; i++) {
        scanf("%d%d%d", &u, &v, &t);
        e[u].push_back(pair<int, int>(v, t));
        e[v].push_back(pair<int, int>(u, t));
      }
      mini = maxi = 0;
      dfs(1, 0);
      printf("%lld %lld\n", mini, maxi);
    }
  }
  return 0;
}
