#include <bits/stdc++.h>
using namespace std;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int N = 2e5, M = 1e9 + 7;
int k, sz[N];
long long mx, mn;
vector<pair<int, int>> g[N];
void dfs(int u, int p) {
  sz[u] = 1;
  for (auto i : g[u]) {
    if (i.first == p) continue;
    dfs(i.first, u);
    mn += (min(sz[i.first], k - sz[i.first]) % 2) * i.second;
    mx += min(sz[i.first], k - sz[i.first]) * 1LL * i.second;
    sz[u] += sz[i.first];
  }
}
void solve() {
  mx = mn = 0;
  scanf("%d", &k);
  k <<= 1;
  for (int i = 0; i < k; i++) g[i].clear();
  for (int i = 0, a, b, c; i < k - 1; i++) {
    scanf("%d%d%d", &a, &b, &c);
    g[--a].push_back({--b, c});
    g[b].push_back({a, c});
  }
  dfs(0, -1);
  printf("%lld %lld\n", mn, mx);
}
int main() {
  int T;
  cin >> T;
  while (T--) solve();
}
