#include <bits/stdc++.h>
using namespace std;
const int mod7 = 1000000007;
const int MAXN = 200000 + 42;
vector<pair<int, int>> g[MAXN];
int n;
int cnt[MAXN];
int dudes[MAXN];
int par[MAXN];
int uu[MAXN];
long long pare[MAXN];
long long G = 0;
long long B = 0;
void dfs(int v = 0, int p = 0, long long e = 0) {
  par[v] = p;
  pare[v] = e;
  dudes[v] = 1;
  cnt[v] = 1;
  for (auto toe : g[v]) {
    int to = toe.first;
    int ed = toe.second;
    if (to != p) {
      dfs(to, v, ed);
      cnt[v] += cnt[to];
    }
  }
  B += e * min(cnt[v], n - cnt[v]);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    G = B = 0;
    int k;
    cin >> k;
    n = k * 2;
    for (int i = 0; i < n; i++) g[i].clear(), uu[i] = 0;
    for (int i = 1; i < n; i++) {
      int x, y, c;
      cin >> x >> y >> c;
      x--;
      y--;
      g[x].push_back({y, c});
      g[y].push_back({x, c});
    }
    dfs();
    queue<int> ptrs;
    for (int i = 0; i < n; i++)
      if (g[i].size() == 1) {
        ptrs.push(i);
      }
    while (!ptrs.empty()) {
      int ptr = ptrs.front();
      ptrs.pop();
      if (par[ptr] != ptr) {
        int a = dudes[ptr];
        int b = dudes[par[ptr]];
        G += a * pare[ptr];
        dudes[par[ptr]] = max(a - b, b - a);
        uu[par[ptr]]++;
        if (uu[par[ptr]] == g[par[ptr]].size() - 1) ptrs.push(par[ptr]);
      }
    }
    cout << G << " " << B << endl;
  }
  return 0;
}
