#include <bits/stdc++.h>
using namespace std;
long long ansmax, ansmin;
vector<pair<int, int>> vec[200005];
int siz[200005], k;
void dfs(int now, int fa) {
  for (int i = 0; i < vec[now].size(); i++) {
    pair<int, int> tmp = vec[now][i];
    if (tmp.first == fa) continue;
    dfs(tmp.first, now);
    if (siz[tmp.first] % 2) ansmin += tmp.second;
    ansmax += 1ll * min(siz[tmp.first], k - siz[tmp.first]) * tmp.second;
    siz[now] += siz[tmp.first];
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &k);
    k *= 2;
    for (int i = 1; i <= k; i++) {
      siz[i] = 1;
      vec[i].clear();
    }
    for (int i = 1; i < k; i++) {
      int u, v, w;
      scanf("%d%d%d", &u, &v, &w);
      vec[u].push_back({v, w});
      vec[v].push_back({u, w});
    }
    ansmax = ansmin = 0;
    dfs(1, 0);
    printf("%lld %lld\n", ansmin, ansmax);
  }
}
