#include <bits/stdc++.h>
using namespace std;
long long child[200005] = {0};
long long ans1 = 0, ans2 = 0, N;
vector<pair<long long, long long> > Next[200005];
long long F(long long here, long long Fa, long long con) {
  child[here] = 1;
  for (auto i : Next[here]) {
    if (i.first != Fa) {
      child[here] += F(i.first, here, i.second);
    }
  }
  if (child[here] % 2) ans1 += con;
  ans2 += con * (min(child[here], N - child[here]));
  return child[here];
}
int main() {
  long long T, i, a, b, c;
  scanf("%lld", &T);
  while (T--) {
    scanf("%lld", &N);
    N *= 2;
    for (i = 1; i <= N; i++) Next[i].clear();
    ans1 = 0;
    ans2 = 0;
    for (i = 1; i < N; i++) {
      scanf("%lld %lld %lld", &a, &b, &c);
      Next[a].push_back(make_pair(b, c));
      Next[b].push_back(make_pair(a, c));
    }
    F(1, 0, 0);
    printf("%lld %lld\n", ans1, ans2);
  }
  return 0;
}
