#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int INF = 0x3f3f3f3f;
int _w;
int n, f[N], siz[N], head[N], eidx;
vector<long long> vec[N];
long long ans1, ans2;
struct Ele {
  int u, v, val;
} dat[N];
struct Edge {
  int nxt, to, val;
} edge[N << 1];
inline void addedge(const int& u, const int& v, const int& w) {
  edge[++eidx] = (Edge){head[u], v, w};
  head[u] = eidx;
  edge[++eidx] = (Edge){head[v], u, w};
  head[v] = eidx;
}
long long dfs(const int& u, const int& fa) {
  vec[u].clear(), siz[u] = 1;
  for (int i = head[u], v, x; i; i = edge[i].nxt)
    if ((v = edge[i].to) != fa) {
      x = dfs(v, u) + edge[i].val;
      siz[u] += siz[v];
      if (x < 0) continue;
      vec[u].push_back(x);
    }
  for (const long long& v : vec[u]) ans1 += v;
  if (vec[u].size() & 1)
    return -INF;
  else
    return 0;
}
inline void solve(void) {
  _w = scanf("%d", &n);
  n <<= 1, ans1 = ans2 = 0;
  for (int i = 1; i <= n; ++i) head[i] = 0;
  eidx = 0;
  for (int i = 1; i < n; ++i) {
    _w = scanf("%d%d%d", &dat[i].u, &dat[i].v, &dat[i].val);
    addedge(dat[i].u, dat[i].v, dat[i].val);
  }
  dfs(1, 1);
  for (int i = 1, a, b; i < n; ++i) {
    a = siz[dat[i].u], b = siz[dat[i].v];
    if (a > b) swap(a, b);
    b = n - a;
    ans2 += 1LL * dat[i].val * min(a, b);
  }
  printf("%lld %lld\n", ans1, ans2);
}
int main(void) {
  int T;
  _w = scanf("%d", &T);
  while (T--) solve();
  return 0;
}
