#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
vector<pair<long long, long long> > v[200005];
long long s[200005], n;
long long dfsn(long long p, long long la) {
  long long re = 0;
  s[p] = 1;
  for (auto u : v[p]) {
    if (u.first == la) continue;
    re = re + dfsn(u.first, p);
    if (s[u.first] & 1) re = re + u.second;
    s[p] += s[u.first];
  }
  return re;
}
long long dfsx(long long p, long long la) {
  long long re = 0;
  s[p] = 1;
  for (auto u : v[p]) {
    if (u.first == la) continue;
    re = re + dfsx(u.first, p);
    re = re + min(s[u.first], n - s[u.first]) * u.second;
    s[p] += s[u.first];
  }
  return re;
}
void solve() {
  cin >> n;
  n <<= 1;
  for (long long i = 1; i <= n; i++) v[i].clear();
  long long x, y, z;
  for (long long i = 1; i < n; i++) {
    cin >> x >> y >> z;
    v[x].emplace_back(make_pair(y, z));
    v[y].emplace_back(make_pair(x, z));
  }
  cout << dfsn(1, -1) << ' ' << dfsx(1, -1) << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) solve();
  return 0;
}
