#include <bits/stdc++.h>
const int maxn = 2e5 + 500;
const int mod = 1e9 + 7;
const int inf = 123456789;
using namespace std;
int n, m;
vector<pair<long long, long long> > q[maxn];
int vis[maxn];
long long G, B;
void dfs(int x, int f) {
  vis[x] = 1;
  for (auto i : q[x]) {
    if (i.first == f) continue;
    dfs(i.first, x);
    if (vis[i.first] % 2) G += i.second;
    B += min(vis[i.first], 2 * m - vis[i.first]) * i.second;
    vis[x] += vis[i.first];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  while (n--) {
    cin >> m;
    for (int i = 1; i <= 2 * m; i++) {
      q[i].clear();
      vis[i] = 0;
    }
    G = 0, B = 0;
    for (int i = 1; i < 2 * m; i++) {
      int u, v;
      long long w;
      cin >> u >> v >> w;
      q[u].emplace_back(v, w);
      q[v].emplace_back(u, w);
    }
    dfs(1, 0);
    cout << G << " " << B << '\n';
  }
  return 0;
}
