#include <bits/stdc++.h>
using namespace std;
int n;
long long v1, v2;
vector<int> sz;
vector<vector<pair<int, int>>> g;
void dfs(int u, int p, int c) {
  sz[u] = 1;
  for (auto &e : g[u]) {
    int v = e.first;
    if (v == p) continue;
    dfs(v, u, e.second);
    sz[u] += sz[v];
  }
  v1 += 1LL * (sz[u] & 1) * c;
  v2 += 1LL * min(sz[u], 2 * n - sz[u]) * c;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    g.assign(2 * n + 1, vector<pair<int, int>>());
    for (int i = 1, a, b, c; i <= 2 * n - 1; ++i) {
      cin >> a >> b >> c;
      g[a].push_back({b, c});
      g[b].push_back({a, c});
    }
    v1 = v2 = 0;
    sz.assign(2 * n + 1, 0);
    dfs(1, 0, 0);
    cout << v1 << " " << v2 << "\n";
  }
}
