#include <bits/stdc++.h>
int solve();
int main(int argc, char* argv[]) {
  int tc = 1;
  scanf("%d", &tc);
  while (tc--) {
    solve();
  }
  return 0;
}
constexpr int MOD = 1000 * 1000 * 1000 + 7;
int solve() {
  int K;
  scanf("%d", &K);
  K = K * 2;
  std::vector<std::vector<std::pair<int, int> > > g(K);
  for (int i = 1; i < K; ++i) {
    int a, b, t;
    scanf("%d%d%d", &a, &b, &t);
    --a, --b;
    g[a].push_back(std::make_pair(b, t));
    g[b].push_back(std::make_pair(a, t));
  }
  std::vector<int> que(1, 0);
  std::vector<int> parent(K, -1);
  parent[0] = 0;
  std::vector<int> parent_cost(K, 0);
  for (int head = 0; head < que.size(); ++head) {
    int i = que[head];
    for (auto [j, t] : g[i]) {
      if (parent[j] == -1) {
        parent[j] = i;
        parent_cost[j] = t;
        que.push_back(j);
      }
    }
  }
  std::reverse(que.begin(), que.end());
  std::vector<int> size(K, 1);
  long long max = 0, min = 0;
  for (int i : que) {
    size[parent[i]] += size[i];
    max += parent_cost[i] * 1LL * std::min(size[i], K - size[i]);
    min += parent_cost[i] * (size[i] % 2);
  }
  printf("%lld %lld\n", min, max);
  return 0;
}
