#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int mex = 1e5 + 5;
inline long long power(long long a, long long b) {
  long long ans = 1, temp = a;
  while (b != 0) {
    if (b & 1) ans = ans * temp;
    ans = ans % mod;
    temp = temp * temp;
    temp = temp % mod;
    b /= 2;
  }
  return ans;
}
int pr[mex];
vector<int> prime;
inline void seive() {
  for (int i = 2; i < mex; i++) pr[i] = 1;
  for (int i = 2; i * i < mex; i++) {
    if (pr[i])
      for (int j = i * i; j < mex; j += i) pr[j] = 0;
  }
  for (int i = 2; i < mex; i++) {
    if (pr[i]) prime.push_back(i);
  }
}
long long int xx, xy, d1;
void exeu(long long int a1, long long int b1) {
  if (b1 == 0) {
    xx = 1;
    xy = 0;
    d1 = a1;
  } else {
    exeu(b1, a1 % b1);
    long long int temp = xx;
    xx = xy;
    xy = temp - (a1 / b1) * xy;
  }
}
long long int modinv(long long int A, long long int M) {
  exeu(A, M);
  return (xx % M + M) % M;
}
vector<int> v;
void dfs(int s, bool vis[], vector<pair<long long int, long long int> > adj[],
         int par[], long long int cost[]) {
  vis[s] = true;
  v.push_back(s);
  for (int i = 0; i < adj[s].size(); i++) {
    int x = adj[s][i].first;
    if (!vis[x]) {
      par[x] = s;
      cost[x] = adj[s][i].second;
      dfs(x, vis, adj, par, cost);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int k;
    cin >> k;
    vector<pair<long long int, long long int> > adj[2 * k];
    bool vis[2 * k];
    int par[2 * k];
    long long int cost[2 * k];
    memset(par, -1, sizeof(par));
    memset(cost, 0, sizeof(cost));
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < 2 * k - 1; i++) {
      int a, b;
      long long c;
      cin >> a >> b >> c;
      a--;
      b--;
      adj[a].push_back({b, c});
      adj[b].push_back({a, c});
    }
    par[0] = 0;
    dfs(0, vis, adj, par, cost);
    long long int mx = 0, mn = 0;
    reverse(v.begin(), v.end());
    long long int size[2 * k];
    for (int i = 0; i < 2 * k; i++) size[i] = 1;
    for (auto it : v) {
      size[par[it]] += size[it];
      mx += cost[it] * (min(size[it], (2 * k - size[it])));
      mn += cost[it] * (size[it] & 1);
    }
    cout << mn << " " << mx << endl;
    v.clear();
  }
  return 0;
}
