#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n;
vector<pair<int, int> > v[maxn];
int size[maxn];
long long mi, mx;
void dfs(int first, int fa) {
  size[first] = 1;
  for (pair<int, int> i : v[first]) {
    if (i.first == fa) continue;
    dfs(i.first, first);
    if (size[i.first] & 1) mi += 1LL * i.second;
    size[first] += size[i.first];
    mx += 1LL * min(n - size[i.first], size[i.first]) * i.second;
  }
}
void solve() {
  scanf("%d", &n);
  n = n * 2;
  for (int i = 1; i <= n; i++) v[i].clear();
  for (int i = 1, first, second, z; i < n; i++) {
    scanf("%d%d%d", &first, &second, &z);
    v[first].push_back({second, z});
    v[second].push_back({first, z});
  }
  mi = 0, mx = 0;
  dfs(1, 0);
  printf("%lld %lld\n", mi, mx);
}
int T;
int main() {
  scanf("%d", &T);
  while (T--) solve();
  return 0;
}
