#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
const int Mod = 1e9 + 7;
const int MaxN = 1e6 + 5;
vector<pair<int, int> > G[MaxN];
long long Min, Max;
int n;
int dfs(int x, int fa) {
  int all = 1;
  for (int i = 0; i < G[x].size(); i++) {
    int y = G[x][i].first, w = G[x][i].second;
    if (y != fa) {
      int S = dfs(y, x);
      all += S;
      if (S % 2) Min += w;
      Max += 1LL * w * (S < n - S ? S : n - S);
    }
  }
  return all;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    Min = Max = 0LL;
    scanf("%d", &n);
    n *= 2;
    for (int i = 1; i < n; i++) {
      int u, v, w;
      scanf("%d %d %d", &u, &v, &w);
      G[u].push_back(pair<int, int>(v, w));
      G[v].push_back(pair<int, int>(u, w));
    }
    dfs(1, 0);
    printf("%lld %lld\n", Min, Max);
    for (int i = 1; i <= n; i++) G[i].clear();
  }
  return 0;
}
