#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int T;
int n;
int u, v, w;
vector<pair<int, int> > g[200010];
int fa[200010];
long long dp[200010], son[200010], ms[200010], ans;
void dfs(int u, int f) {
  son[u] = 1;
  fa[u] = f;
  int v;
  for (auto i : g[u])
    if (i.first != f) {
      v = i.first;
      dfs(v, u);
      son[u] += son[v];
      ans += son[v] * i.second;
      ms[u] = max(ms[u], son[v]);
      if (son[v] % 2 == 0) {
        dp[u] += dp[v];
      } else {
        dp[u] += dp[v] + i.second;
      }
    }
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    n *= 2;
    for (int i = 1; i <= n; i++)
      g[i].clear(), dp[i] = 0, son[i] = 0, ms[i] = 0, fa[i] = 0;
    for (int i = 1; i < n; i++) {
      scanf("%d%d%d", &u, &v, &w);
      g[u].push_back(pair<int, int>(v, w));
      g[v].push_back(pair<int, int>(u, w));
    }
    dfs(1, 1);
    printf("%lld ", dp[1]);
    int pos = 1;
    for (int i = 1; i <= n; i++)
      if (max(n - son[i], ms[i]) <= max(n - son[pos], ms[pos])) pos = i;
    ans = 0;
    for (int i = 1; i <= n; i++) son[i] = 0;
    dfs(pos, pos);
    printf("%lld\n", ans);
  }
  return 0;
}
