#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7;
const int mod = 1e9 + 7;
int n;
long long p[N];
long long sz[N];
vector<pair<int, int> > v[N];
void dfs(int x, int pp) {
  sz[x] = 1;
  for (auto y : v[x]) {
    if (y.first != pp) {
      dfs(y.first, x);
      p[y.first] = y.second;
      sz[x] += sz[y.first];
    }
  }
}
void solve1() {
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) {
    v[i].clear();
    sz[i] = 0;
    p[i] = 0;
  }
  vector<pair<int, pair<int, int> > > g;
  for (int i = 1; i < 2 * n; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    v[x].push_back({y, z});
    v[y].push_back({x, z});
    g.push_back({x, {y, z}});
  }
  dfs(1, 1);
  long long mn = 0;
  long long mx = 0;
  for (int i = 2; i <= 2 * n; i++) {
    mx = mx + min(sz[i], n + n - sz[i]) * p[i];
    if ((sz[i] & 1)) {
      mn += p[i];
    }
  }
  cout << mn << " " << mx << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  int cghf = 1;
  cin >> cghf;
  while (cghf--) {
    solve1();
  }
}
