#include <bits/stdc++.h>
using namespace std;
int num_children[666666];
int pars[666666];
vector<pair<int, int>> edges[666666];
int dfs(int par, int u, int k, int edge_cost, long long* min_sum,
        long long* max_sum) {
  pars[u] = par;
  int ans = 1;
  for (const pair<int, int>& vc : edges[u]) {
    if (vc.first == par) continue;
    ans += dfs(u, vc.first, k, vc.second, min_sum, max_sum);
  }
  num_children[u] = ans;
  if (num_children[u] % 2 == 1) {
    (*min_sum) += edge_cost;
  }
  long long x = min(k, min(ans, 2 * k - ans));
  (*max_sum) += x * edge_cost;
  return ans;
}
int main() {
  int T;
  cin >> T;
  for (int t = 1; t <= T; t++) {
    int k;
    cin >> k;
    for (int i = 1; i <= 2 * k; i++) edges[i].clear();
    for (int i = 1; i <= 2 * k - 1; i++) {
      int a, b, t;
      cin >> a >> b >> t;
      edges[a].push_back({b, t});
      edges[b].push_back({a, t});
    }
    long long min_sum = 0;
    long long max_sum = 0;
    dfs(-1, 1, k, 0, &min_sum, &max_sum);
    printf("%lld %lld\n", min_sum, max_sum);
  }
}
