#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, ll>;
using db = double;
using vi = vector<int>;
const int inf = 0x3f3f3f3f;
const db eps = 1e-8;
const int mod = 1e9 + 7;
ll qpow(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    n <<= 1;
    vector<vector<pii>> e(n);
    for (int i = 1; i < n; ++i) {
      int a, b;
      ll c;
      cin >> a >> b >> c;
      a--;
      b--;
      e[a].emplace_back(make_pair(b, c));
      e[b].emplace_back(make_pair(a, c));
    }
    ll mn = 0, mx = 0;
    vi sz(n, 0);
    function<void(int, int)> dfs = [&](int u, int fa) {
      sz[u] = 1;
      for (auto i : e[u]) {
        int v = i.first;
        ll w = i.second;
        if (v == fa) continue;
        dfs(v, u);
        sz[u] += sz[v];
        mn += (sz[v] & 1) * w;
        mx += w * min(sz[v], n - sz[v]);
      }
    };
    dfs(0, -1);
    cout << mn << " " << mx << "\n";
  }
}
