#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void make_tree(vector<vector<pair<int, ll>>> &vect, vector<int> &parent,
               vector<ll> &cost, vector<int> &que, int i) {
  for (int j = 0; j < vect[i].size(); j++) {
    int k = vect[i][j].first;
    int c = vect[i][j].second;
    if (parent[k] == -1) {
      parent[k] = i;
      cost[k] = c;
      que.push_back(k);
      make_tree(vect, parent, cost, que, k);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<vector<pair<int, ll>>> vect(2 * n);
    for (int i = 0; i < 2 * n - 1; i++) {
      int a, b;
      ll c;
      cin >> a >> b >> c;
      a--;
      b--;
      vect[a].push_back({b, c});
      vect[b].push_back({a, c});
    }
    n = 2 * n;
    vector<int> parent(n, -1), size(n, 1), que(1, 0);
    vector<ll> cost(n, 0);
    parent[0] = 0;
    make_tree(vect, parent, cost, que, 0);
    reverse(que.begin(), que.end());
    ll maxi = 0, mini = 0;
    for (int i : que) {
      size[parent[i]] += size[i];
      maxi += cost[i] * min(size[i], n - size[i]);
      mini += cost[i] * (size[i] & 1);
    }
    cout << mini << " " << maxi << endl;
  }
}
