#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 3;
const long long MOD = 1e9 + 7;
const long long MX = 1e9 + 3;
int sub[2 * MAX], par[2 * MAX];
vector<int> g[2 * MAX];
void dfs(int u, int p) {
  par[u] = p;
  sub[u] = 1;
  for (int x : g[u]) {
    if (x != p) {
      dfs(x, u);
      sub[u] += sub[x];
    }
  }
}
void solve() {
  int k;
  cin >> k;
  vector<pair<int, int> > edges;
  vector<int> wts;
  for (int i = 0; i < 2 * k - 1; i++) {
    int a, b, t;
    cin >> a >> b >> t;
    edges.push_back({a, b});
    wts.push_back(t);
    g[a].push_back(b), g[b].push_back(a);
  }
  dfs(1, 0);
  long long G = 0, B = 0;
  for (int i = 0; i < 2 * k - 1; i++) {
    int u = edges[i].first, v = edges[i].second;
    if (par[v] != u) swap(u, v);
    int cu = 2 * k - sub[v], cv = sub[v];
    B += 1LL * min(cu, cv) * wts[i];
    if (cu % 2 or cv % 2) G += 1LL * wts[i];
  }
  cout << G << " " << B << "\n";
  for (int i = 1; i <= 2 * k; i++) {
    g[i].clear();
    sub[i] = 0, par[i] = 0;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
