#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
vector<pair<int, long long> > G[MAXN];
int sz[MAXN], k;
long long g, b;
void pre_dfs(int u, int p) {
  sz[u] = 1;
  for (int i = 0; i < (int)G[u].size(); i++) {
    int viz = G[u][i].first;
    if (viz == p) continue;
    pre_dfs(viz, u);
    sz[u] += sz[viz];
  }
}
void dfs(int u, int p) {
  for (int i = 0; i < (int)G[u].size(); i++) {
    int viz = G[u][i].first;
    if (viz == p) continue;
    if (sz[viz] % 2 == 1) g += G[u][i].second;
    b += G[u][i].second * min(sz[viz], k - sz[viz]);
    dfs(viz, u);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    cin >> k;
    k = 2 * k;
    for (int i = 1; i < k; i++) {
      int ui, vi;
      long long wi;
      cin >> ui >> vi >> wi;
      G[ui].push_back({vi, wi});
      G[vi].push_back({ui, wi});
    }
    pre_dfs(1, 0);
    g = 0;
    b = 0;
    dfs(1, 0);
    cout << g << " " << b << endl;
    for (int i = 1; i <= k; i++) G[i].clear();
  }
}
