#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 2e5 + 4;
vector<pair<int, long long>> v[N];
long long mn, mx;
int n;
long long sz[N];
void dfs(int node, int par) {
  sz[node] = 1;
  for (auto it : v[node])
    if (it.first != par) {
      int x = it.first;
      long long wt = it.second;
      dfs(x, node);
      long long val = min((long long)n - sz[x], sz[x]);
      val *= wt;
      mx += val;
      val = sz[x] % 2;
      mn += (wt * val);
      sz[node] += sz[x];
    }
}
void init(int n) {
  for (int i = 1; i < n + 1; i++) {
    v[i].clear();
    sz[i] = 0;
  }
  mn = mx = 0;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    n *= 2;
    init(n);
    for (int i = 0; i < n - 1; i++) {
      int a, b;
      long long wt;
      scanf("%d", &a);
      scanf("%d", &b);
      scanf("%lld", &wt);
      v[a].push_back(make_pair(b, wt));
      v[b].push_back(make_pair(a, wt));
    }
    dfs(1, -1);
    printf("%lld %lld\n", mn, mx);
  }
  return 0;
}
