#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
long long MOD = 1e9 + 7;
long long mini = 0;
long long maxi = 0;
int N;
void dfs(int n, int par, vector<vector<pair<long long, long long> > > &adj,
         vector<long long> &s) {
  s[n] = 1;
  for (int i = 0; i < adj[n].size(); i++) {
    if (adj[n][i].first != par) {
      dfs(adj[n][i].first, n, adj, s);
      s[n] += s[adj[n][i].first];
      if (s[adj[n][i].first] % 2 == 1) mini += adj[n][i].second;
      long long val = s[adj[n][i].first];
      long long temp = min(val, N - val);
      maxi += adj[n][i].second * temp;
    }
  }
}
void solve() {
  int k;
  cin >> k;
  int n = 2 * k;
  N = n;
  mini = 0, maxi = 0;
  vector<vector<pair<long long, long long> > > adj(n + 1);
  for (int i = 1; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    adj[a].push_back(pair<long long, long long>(b, c));
    adj[b].push_back(pair<long long, long long>(a, c));
  }
  vector<long long> s(n + 1, 0);
  dfs(1, 1, adj, s);
  cout << mini << " " << maxi << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
