#include <bits/stdc++.h>
using namespace std;
const int N = 200001;
int n, k, sz[N];
vector<pair<int, int> > v[N];
vector<pair<pair<int, int>, int> > edges;
void dfs(int node, int pnode) {
  sz[node] = 1;
  for (auto &i : v[node]) {
    if (i.first == pnode) continue;
    dfs(i.first, node);
    sz[node] += sz[i.first];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    edges.clear();
    cin >> k;
    n = 2 * k;
    for (int i = 1; i <= n; i++) {
      v[i].clear();
      sz[i] = 0;
    }
    for (int i = 0; i < n - 1; i++) {
      int x, y, z;
      cin >> x >> y >> z;
      v[x].push_back({y, z});
      v[y].push_back({x, z});
      edges.push_back({{x, y}, z});
    }
    dfs(1, 0);
    long long mn = 0, mx = 0;
    for (auto &i : edges) {
      int x = i.first.first;
      int y = i.first.second;
      int z = i.second;
      if (sz[x] < sz[y]) swap(x, y);
      mn += sz[y] % 2 * z;
      mx += 1LL * min(n - sz[y], sz[y]) * z;
    }
    cout << mn << " " << mx << endl;
  }
}
