#include <bits/stdc++.h>
using namespace std;
long long pw(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b % 2) ans *= a;
    a *= a;
    b /= 2;
  }
  return (ans);
}
const long long mxn = 2e5 + 1;
vector<vector<array<long long, 2> > > g;
vector<long long> s;
long long n, mn, mx;
void dfs(long long u, long long pu) {
  s[u] = 1;
  for (long long i = 0; i < g[u].size(); i++) {
    long long v = g[u][i][0], w = g[u][i][1];
    if (v == pu) continue;
    dfs(v, u);
    s[u] += s[v];
    mn += (s[v] % 2) * w;
    mx += w * min(s[v], n - s[v]);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> q;
  while (q--) {
    cin >> n;
    n *= 2;
    g = vector<vector<array<long long, 2> > >(n + 1);
    s = vector<long long>(n + 1);
    for (long long i = 1; i < n; i++) {
      long long u, v, w;
      cin >> u >> v >> w;
      g[u].push_back({v, w});
      g[v].push_back({u, w});
    }
    mn = mx = 0;
    dfs(1, 0);
    cout << mn << " " << mx << "\n";
  }
  return 0;
}
