#include <bits/stdc++.h>
using namespace std;
vector<int> D;
vector<bool> Bio;
void Construct(const vector<vector<pair<int, int> > > &Graph, int src = 0) {
  if (Bio[src]) return;
  Bio[src] = true;
  D[src]++;
  for (auto nod : Graph[src]) {
    if (!Bio[nod.first]) {
      Construct(Graph, nod.first);
      D[src] += D[nod.first];
    }
  }
}
void Main() {
  int n;
  cin >> n;
  n *= 2;
  vector<vector<pair<int, int> > > Graph(n);
  for (int i = 0; i < n - 1; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    Graph[x - 1].push_back({y - 1, c});
    Graph[y - 1].push_back({x - 1, c});
  }
  Bio.resize(n);
  D.resize(n);
  for (int i = 0; i < n; i++) {
    Bio[i] = 0;
    D[i] = 0;
  }
  Construct(Graph);
  unsigned long long REZ1 = 0, REZ2 = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < Graph[i].size(); j++) {
      int L = min(D[i], D[Graph[i][j].first]);
      int R = n - L;
      REZ2 += (unsigned long long)min(L, R) *
              (unsigned long long)Graph[i][j].second;
      REZ1 +=
          (unsigned long long)(L % 2) * (unsigned long long)Graph[i][j].second;
    }
  }
  cout << REZ1 / 2 << endl << REZ2 / 2 << endl;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    Main();
  }
}
