#include <bits/stdc++.h>
using namespace std;
vector<pair<int, long long>> edge[200000 + 10];
long long ans1 = 0, ans2 = 0;
int n;
long long dfs(int now, int first) {
  int len = edge[now].size();
  int rt = 0;
  for (int i = (0); i < (len); i++) {
    if (edge[now][i].first == first) continue;
    long long son = dfs(edge[now][i].first, now);
    rt += son;
    ans2 += 1ll * min(son, 2 * n - son) * edge[now][i].second;
    if (son % 2 != 0) ans1 += edge[now][i].second;
  }
  return rt + 1;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    ans1 = 0;
    ans2 = 0;
    cin >> n;
    for (int i = (0); i < (2 * n - 1); i++) {
      int u, v;
      long long w;
      cin >> u >> v >> w;
      edge[u].push_back(make_pair(v, w));
      edge[v].push_back(make_pair(u, w));
    }
    dfs(1, 0);
    cout << ans1 << " " << ans2 << "\n";
    for (int i = (1); i < (2 * n + 1); i++) {
      edge[i].clear();
    }
  }
  return 0;
}
