#include <bits/stdc++.h>
using namespace std;
const long long M = 3e5 + 1;
vector<vector<long long> > g(M);
vector<bool> vis(M);
vector<long long> siz(M);
void dfs(long long u) {
  vis[u] = true;
  siz[u] = 1;
  for (auto x : g[u]) {
    if (vis[x]) continue;
    dfs(x);
    siz[u] += siz[x];
  }
}
void solve() {
  long long n;
  cin >> n;
  n *= 2;
  vector<vector<long long> > edges(n - 1, vector<long long>(3));
  for (long long i = 0; i < n - 1; i++) {
    cin >> edges[i][0] >> edges[i][1] >> edges[i][2];
    g[edges[i][0]].push_back(edges[i][1]);
    g[edges[i][1]].push_back(edges[i][0]);
  }
  dfs(1);
  long long ans1, ans2;
  ans1 = ans2 = 0;
  for (auto x : edges) {
    long long u = x[0];
    long long v = x[1];
    if (siz[u] < siz[v]) {
      u ^= v;
      v ^= u;
      u ^= v;
    }
    if (siz[v] & 1) {
      ans1 += x[2];
    }
    ans2 += min(n - siz[v], siz[v]) * x[2];
  }
  cout << ans1 << " " << ans2 << '\n';
  ;
  for (long long i = 1; i <= n; i++) {
    g[i].clear();
    vis[i] = false;
    siz[i] = 0;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc;
  tc = 1;
  cin >> tc;
  for (int i = 1; i <= tc; i++) {
    solve();
  }
  return 0;
}
