#include <bits/stdc++.h>
using namespace std;
vector<int> v[200005];
long long ans = 0;
map<int, int> mp[200005];
int dp[200005];
long long ansmn, ansmx;
int n;
void dfs(int x, int p) {
  dp[x] = 1;
  for (int i = 0; i < v[x].size(); i++) {
    if (v[x][i] != p) {
      dfs(v[x][i], x);
      if (dp[v[x][i]] & 1) {
        ansmn += mp[x][v[x][i]];
      }
      ansmx += 1LL * min(dp[v[x][i]], n - dp[v[x][i]]) * mp[x][v[x][i]];
      dp[x] += dp[v[x][i]];
    }
  }
}
void solve() {
  cin >> n;
  n *= 2;
  for (int i = 1; i < n + 1; i++) {
    dp[i] = 0;
    v[i].clear();
    mp[i].clear();
    ansmn = 0;
    ansmx = 0;
  }
  for (int i = 1; i < n; i++) {
    int x, y, w;
    cin >> x >> y >> w;
    v[x].push_back(y);
    v[y].push_back(x);
    mp[x][y] = mp[y][x] = w;
  }
  dfs(1, 0);
  cout << ansmn << " " << ansmx << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
