#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
vector<pair<int, int> > graf[MAXN];
long long dp[MAXN];
long long mn, mx;
int n;
void dfs(int nod, int tata) {
  dp[nod] = 1;
  for (auto x : graf[nod]) {
    if (x.first == tata) continue;
    dfs(x.first, nod);
    dp[nod] += dp[x.first];
    mn += 1LL * (dp[x.first] % 2) * x.second;
    mx += 1LL * min(dp[x.first], 2 * n - dp[x.first]) * x.second;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= 2 * n; ++i) graf[i].clear();
    for (int i = 1; i <= 2 * n; ++i) dp[i] = 0;
    mn = mx = 0;
    for (int i = 1; i < 2 * n; ++i) {
      int x, y, c;
      cin >> x >> y >> c;
      graf[x].push_back({y, c});
      graf[y].push_back({x, c});
    }
    dfs(1, 0);
    cout << mn << " " << mx << "\n";
  }
  return 0;
}
