#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
int t, n, sz[N];
long long mx, mn;
vector<pair<int, int> > adj[N];
int dfs(int u, int v) {
  sz[u] = 1;
  for (auto x : adj[u])
    if (x.first != v) sz[u] += dfs(x.first, u);
  return sz[u];
}
void dfs2(int u, int v) {
  for (auto x : adj[u]) {
    if (x.first == v) continue;
    mx += 1LL * min(sz[x.first], 2 * n - sz[x.first]) * x.second;
    mn += 1LL * (sz[x.first] & 1) * x.second;
    dfs2(x.first, u);
  }
}
void _clear() {
  for (int i = 1; i <= 2 * n; i++) adj[i].clear();
  mx = mn = 0;
}
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    _clear();
    for (int i = 0; i < 2 * n - 1; i++) {
      int a, b, c;
      scanf("%d%d%d", &a, &b, &c);
      adj[a].push_back({b, c});
      adj[b].push_back({a, c});
    }
    dfs(1, 1);
    dfs2(1, 1);
    printf("%lld %lld\n", mn, mx);
  }
}
