#include <bits/stdc++.h>
using namespace std;
struct E {
  int to, w;
};
const int N = 2e5 + 5;
vector<E> g[N];
long long ans_g = 0, ans_b = 0;
int sz[N];
int n;
bool dfs(int node, int anc) {
  int alone = 0;
  for (E e : g[node]) {
    if (e.to != anc) {
      bool ok = dfs(e.to, node);
      if (!ok) {
        if (alone) {
          ans_g += alone + e.w;
          alone = 0;
        } else {
          alone = e.w;
        }
      }
    }
  }
  if (alone) {
    ans_g += alone;
    return true;
  }
  return false;
}
int dive(int node, int anc) {
  int sum = 1;
  sz[node] = 1;
  for (E e : g[node]) {
    if (e.to != anc) {
      int ret = dive(e.to, node);
      sum += ret;
      ans_b += ret * (long long)e.w;
      sz[node] += sz[e.to];
    }
  }
  while (sum > n - sz[node]) sum -= 2;
  return sum;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) {
    cin >> n;
    n *= 2;
    for (int i = 0; i < n - 1; i++) {
      int x, y, z;
      cin >> x >> y >> z;
      x--, y--;
      g[x].push_back({y, z});
      g[y].push_back({x, z});
    }
    ans_b = 0;
    ans_g = 0;
    dfs(0, -1);
    dive(0, -1);
    cout << ans_g << " " << ans_b << "\n";
    for (int i = 0; i < n; i++) g[i].clear();
  }
  return 0;
}
