#include <bits/stdc++.h>
using namespace std;
const int MAXN = 6 * 105000;
int tn;
int n;
vector<pair<int, int> > g[MAXN];
int sz[MAXN];
long long minAns = 0;
long long maxAns = 0;
priority_queue<pair<int, pair<int, int> > > q;
map<int, int> mp[MAXN];
int dfsMin(int v, int p = -1) {
  int fromChildren = 1;
  for (pair<int, int> toP : g[v]) {
    if (toP.first != p) {
      int get = dfsMin(toP.first, v);
      fromChildren += get;
      minAns += 1ll * toP.second * get;
    }
  }
  return fromChildren % 2;
}
int dfsSz(int v, int p = -1) {
  sz[v] = 1;
  for (pair<int, int> toP : g[v]) {
    if (toP.first != p) {
      sz[v] += dfsSz(toP.first, v);
    }
  }
  return sz[v];
}
void dfsMax(int v, int p = -1) {
  for (pair<int, int> toP : g[v]) {
    int cost = toP.second;
    int to = toP.first;
    if (to == p) {
      continue;
    }
    maxAns += 1ll * min(sz[to], n - sz[to]) * cost;
    dfsMax(to, v);
  }
}
void solve() {
  scanf("%d", &n);
  n *= 2;
  for (int i = 0; i < n; i++) {
    g[i].clear();
  }
  for (int i = 0; i < n - 1; i++) {
    int from, to, w;
    scanf("%d %d %d", &from, &to, &w);
    from--;
    to--;
    g[from].push_back(make_pair(to, w));
    g[to].push_back(make_pair(from, w));
  }
  minAns = 0;
  dfsMin(0);
  dfsSz(0);
  maxAns = 0;
  dfsMax(0);
  cout << minAns << " " << maxAns << endl;
}
int main() {
  scanf("%d", &tn);
  while (tn--) {
    solve();
  }
  return 0;
}
