#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int maxn = 3e5 + 3;
void pvec(vector<int> v) {
  for (auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}
long long int gcd(long long int x, long long int y) {
  if (y == 0) {
    return x;
  } else {
    return gcd(y, x % y);
  }
}
long long int binpow(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  }
  long long int res = 1;
  long long int tmp = binpow(a, b / 2);
  res = (tmp * tmp) % mod;
  if (b % 2 == 1) {
    res = (res * a) % mod;
  }
  return res;
}
vector<vector<pair<int, int> > > adj;
vector<bool> vis;
vector<int> child, par;
int dfs1(int u, int pr = 0) {
  vis[u] = true;
  par[u] = pr;
  for (pair<int, int> h : adj[u]) {
    if (!vis[h.first]) {
      child[u] += dfs1(h.first, u);
    }
  }
  return child[u];
}
void solve() {
  adj.clear();
  vis.clear();
  child.clear();
  par.clear();
  int k;
  cin >> k;
  adj.resize(2 * k);
  par.resize(2 * k, 0);
  vis.resize(2 * k, false);
  child.resize(2 * k, 1);
  map<pair<int, int>, long long int> we;
  for (int i = 0; i < 2 * k - 1; i++) {
    int u, v;
    long long int w;
    cin >> u >> v >> w;
    u--;
    v--;
    adj[u].push_back({v, w});
    adj[v].push_back({u, w});
    we[{min(u, v), max(u, v)}] = w;
  }
  dfs1(0);
  long long int g = 0, b = 0;
  for (auto x : we) {
    int u = x.first.first, v = x.first.second;
    if (par[v] != u) {
      swap(u, v);
    }
    int v1 = child[v], v2 = 2 * k - v1;
    if (v1 % 2 == 1) {
      g += x.second;
    }
    b += min(v1, v2) * x.second;
  }
  cout << g << " " << b << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
