#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, N = 2e5 + 5;
int n, t;
int sz[N];
long long mx, mn;
vector<pair<long long, long long> > v1[N];
void dfs(int node, int par) {
  for (auto it : v1[node])
    if (it.first != par) {
      dfs(it.first, node);
      if (sz[it.first] % 2) mn += it.second;
      mx += min(n - sz[it.first], sz[it.first]) * it.second;
      sz[node] += sz[it.first];
    }
  sz[node]++;
}
void init(int n) {
  for (long long i = 0; i < n + 1; i++) v1[i].clear(), sz[i] = 0;
  mn = mx = 0;
}
int main() {
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld", &n);
    n *= 2;
    for (long long i = 1; i < n; i++) {
      int u, v, wt;
      scanf("%lld %lld", &u, &v);
      scanf("%lld", &wt);
      v1[u].push_back({v, wt});
      v1[v].push_back({u, wt});
    }
    dfs(1, -1);
    printf("%lld %lld\n", mn, mx);
    init(n);
  }
}
