#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<long long, long long> > > adjlist;
vector<long long> parent;
vector<long long> cost, q;
vector<long long> si;
int main() {
  long long t;
  cin >> t;
  for (long long o = 0; o < t; o++) {
    long long n;
    cin >> n;
    n *= 2;
    adjlist.assign(n, vector<pair<long long, long long> >());
    parent.assign(n, -1);
    cost.assign(n, 0);
    q.assign(1, 0);
    si.assign(n, 1);
    long long a, b, c;
    for (long long i = 0; i < n - 1; i++) {
      cin >> a >> b >> c;
      adjlist[a - 1].push_back(pair<long long, long long>(b - 1, c));
      adjlist[b - 1].push_back(pair<long long, long long>(a - 1, c));
    }
    parent[0] = 0;
    for (long long i = 0; i < q.size(); i++) {
      long long u = q[i];
      for (long long j = 0; j < adjlist[u].size(); j++) {
        pair<long long, long long> v = adjlist[u][j];
        if (parent[v.first] == -1) {
          parent[v.first] = u;
          cost[v.first] = v.second;
          q.push_back(v.first);
        }
      }
    }
    long long maxi = 0, mini = 0;
    reverse(q.begin(), q.end());
    for (long long i = 0; i < q.size(); i++) {
      si[parent[q[i]]] += si[q[i]];
      maxi += cost[q[i]] * min(si[q[i]], n - si[q[i]]);
      mini += cost[q[i]] * (si[q[i]] % 2);
    }
    cout << mini << " " << maxi << '\n';
    cost.clear();
    parent.clear();
    adjlist.clear();
    q.clear();
    si.clear();
  }
  return 0;
}
