#include <bits/stdc++.h>
using namespace std;
int dfs(int node, int curr_d, vector<vector<int> > &g, vector<int> &sz,
        vector<int> &depth, int parent = -1) {
  depth[node] = curr_d;
  int temp = 1;
  for (int child : g[node]) {
    if (child != parent) {
      temp += dfs(child, curr_d + 1, g, sz, depth, node);
    }
  }
  return sz[node] = temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int k;
    cin >> k;
    vector<pair<int, pair<int, int> > > edges(2 * k - 1);
    vector<vector<int> > g(2 * k + 1);
    for (int i = 0; i < 2 * k - 1; i++) {
      int u, v, dist;
      cin >> u >> v >> dist;
      g[u].push_back(v);
      g[v].push_back(u);
      edges[i].first = dist;
      edges[i].second.first = u;
      edges[i].second.second = v;
    }
    vector<int> sz(2 * k + 1), depth(2 * k + 1);
    dfs(1, 0, g, sz, depth);
    long long G = 0, B = 0;
    sort(edges.begin(), edges.end());
    reverse(edges.begin(), edges.end());
    for (auto e : edges) {
      long long u = e.second.first, v = e.second.second, dist = e.first;
      int lower = (depth[u] > depth[v]) ? u : v;
      if (sz[lower] % 2 == 1) G += dist;
      long long mn = min(sz[lower], 2 * k - sz[lower]);
      B += mn * dist;
    }
    cout << G << " " << B << endl;
  }
  return 0;
}
