#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
long long __pow(long long x, long long y, long long M) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x) % M;
    y >>= 1;
    x = (x * x) % M;
  }
  return res % M;
}
long long __pow(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y >>= 1;
    x = (x * x);
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const long long N = 2e5 + 2, inf = 1e18, M = 1e9 + 7;
long long test, n, m, query, is[N], in[N], out[N], G, B;
bool ok = 1;
vector<pair<long long, long long>> g[N];
void dfs(long long u, long long par = 0) {
  in[u] = 1;
  for (auto [v, w] : g[u])
    if (v != par) {
      dfs(v, u);
      in[u] += in[v];
      is[u] ^= is[v];
      G += is[v] * w;
      B += min(in[v], 2 * n - in[v]) * w;
    }
  is[u] ^= 1;
}
void test_case() {
  cin >> n;
  for (long long i = 1; i <= 2 * n; i++) g[i].clear(), is[i] = 0;
  G = 0, B = 0;
  for (long long i = 1; i < 2 * n; i++) {
    long long u, v, w;
    cin >> u >> v >> w;
    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }
  dfs(1);
  cout << G << " " << B << endl;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  test = 1;
  cin >> test;
  while (test--) test_case();
  return 0;
}
