#include <bits/stdc++.h>
void dfs(long long i, long long par, std::vector<std::vector<long long> > &g,
         std::vector<long long> &sz) {
  long long sum = 1;
  for (auto to : g[i]) {
    if (to == par) continue;
    dfs(to, i, g, sz);
    sum += sz[to];
  }
  sz[i] = sum;
}
struct Edge {
  long long a, b, c;
  Edge(long long a, long long b, long long c) : a(a), b(b), c(c) {}
};
signed main() {
  long long t;
  std::cin >> t;
  for (long long tt = 0; tt < (t); tt++) {
    long long k;
    std::cin >> k;
    std::vector<std::vector<long long> > g(2 * k, std::vector<long long>());
    std::vector<long long> sz(2 * k, 0);
    std::vector<Edge> edges;
    edges.reserve(2 * k - 1);
    for (long long i = 0; i < (2 * k - 1); i++) {
      long long a, b, c;
      std::cin >> a >> b >> c;
      a--;
      b--;
      edges.emplace_back(a, b, c);
      g[a].emplace_back(b);
      g[b].emplace_back(a);
    }
    dfs(0, -1, g, sz);
    long long G = 0, B = 0;
    for (auto e : edges) {
      long long sub = std::min(sz[e.a], sz[e.b]);
      long long cost = e.c;
      if (sub & 1) G += cost;
      B += cost * std::min(2 * k - sub, sub);
    }
    std::cout << G << ' ' << B << '\n';
  }
  return 0;
}
