#include <bits/stdc++.h>
using namespace std;
const int64_t M = 1e9 + 7, N = 1e6 + 5;
vector<vector<int64_t>> tree(N);
int64_t vis[N], val[N], par[N];
void dfs(int64_t node) {
  vis[node] = 1;
  for (auto i : tree[node]) {
    if (!vis[i]) dfs(i), val[node] += val[i], par[i] = node;
  }
  val[node] += 1;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int64_t t;
  cin >> t;
  while (t--) {
    int64_t k;
    cin >> k;
    for (int64_t i = 0; i <= 2 * k + 2; i++)
      tree[i].clear(), vis[i] = 0, val[i] = 0, par[i] = 0;
    map<pair<int64_t, int64_t>, int64_t> mp;
    vector<pair<int64_t, int64_t>> edge;
    for (int64_t i = 0; i < 2 * k - 1; i++) {
      int64_t u, v, w;
      cin >> u >> v >> w;
      edge.push_back({u, v});
      mp[{u, v}] = w;
      mp[{v, u}] = w;
      tree[u].push_back(v);
      tree[v].push_back(u);
    }
    dfs(1);
    int64_t mn = 0, mx = 0;
    for (auto i : edge) {
      int64_t u = i.first, v = i.second;
      int64_t c1, c2;
      if (par[u] == v)
        c1 = val[u], c2 = 2 * k - val[u];
      else
        c1 = val[v], c2 = 2 * k - val[v];
      mx += min(c1, c2) * mp[{u, v}];
      mn += (c1 % 2) * mp[{u, v}];
    }
    cout << mn << " " << mx << "\n";
  }
}
