#include <bits/stdc++.h>
using namespace std;
static vector<int> adj[700005];
static int sz[700005];
void dfs(int u) {
  sz[u] = 1;
  for (int v : adj[u]) {
    if (sz[v] == -1) {
      dfs(v);
      sz[u] += sz[v];
    }
  }
}
struct edge {
  long long u;
  long long v;
  long long w;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    n *= 2;
    for (int i = 0; i < n; i++) adj[i].clear();
    vector<edge> edges;
    fill(sz, sz + n, -1);
    sz[0] = 0;
    for (int i = 0; i < n - 1; i++) {
      long long a, b, c;
      cin >> a >> b >> c;
      a--;
      b--;
      edges.push_back({a, b, c});
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    dfs(0);
    long long good = 0;
    long long bad = 0;
    for (edge e : edges) {
      int u = e.u;
      int v = e.v;
      if (sz[u] > sz[v]) swap(u, v);
      long long szU = sz[u];
      long long szV = n - szU;
      bad += min(szU, szV) * e.w;
      if (szU % 2 == 0 && szV % 2 == 0) {
        continue;
      } else {
        good += e.w;
      }
    }
    cout << good << " " << bad << "\n";
  }
}
