#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 3e5 + 69;
long long m, n, q, x, y, z;
struct vl {
  long long x, y, z;
};
vector<vl> a[MAXN];
long long h[MAXN];
long long check[MAXN];
vl canh[MAXN];
long long con[MAXN];
void dfs(long long x) {
  check[x] = 1;
  con[x] = 1;
  for (long long i = 0; i < a[x].size(); i++) {
    long long u = a[x][i].x;
    if (check[u]) continue;
    h[u] = h[x] + 1;
    dfs(u);
    con[x] += con[u];
  }
}
signed main() {
  cin >> q;
  while (q--) {
    long long maxx = 0;
    long long minn = 0;
    cin >> n;
    n *= 2;
    for (long long i = 1; i < n; i++) {
      cin >> x >> y >> z;
      canh[i] = {x, y, z};
      a[x].push_back({y, z, 0});
      a[y].push_back({x, z, 0});
    }
    for (long long i = 1; i <= n; i++) check[i] = 0, h[i] = 0, con[i] = 0;
    dfs(1);
    for (long long i = 1; i < n; i++) {
      x = canh[i].x;
      y = canh[i].y;
      z = canh[i].z;
      if (h[x] > h[y]) swap(x, y);
      long long sub1 = con[y];
      long long sub2 = n - sub1;
      maxx += z * (min(sub1, sub2));
      minn += z * (sub1 % 2);
    }
    cout << minn << ' ' << maxx << '\n';
    for (long long i = 1; i <= n; i++) a[i].clear();
  }
}
