#include <bits/stdc++.h>
using namespace std;
int k;
vector<pair<int64_t, int64_t> > p[1001000];
int64_t mn, mx;
int64_t sz[1001000];
void dfs(int x, int pp = 0) {
  sz[x] = 1;
  for (int i = 0; i < p[x].size(); i++) {
    if (pp == p[x][i].first) continue;
    dfs(p[x][i].first, x);
    sz[x] += sz[p[x][i].first];
    if (sz[p[x][i].first] % 2 != 0) {
      mn += p[x][i].second;
    }
    mx += min(sz[p[x][i].first], k - sz[p[x][i].first]) * p[x][i].second;
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    scanf("%d", &k);
    k *= 2;
    for (int i = 0; i <= k; i++) p[i].clear();
    int x, y, w;
    for (int i = 0; i < k - 1; i++) {
      scanf("%d%d%d", &x, &y, &w);
      p[x].push_back({y, w});
      p[y].push_back({x, w});
    }
    mn = mx = 0;
    dfs(1);
    printf("%lld %lld\n", mn, mx);
  }
  return 0;
}
