#include <bits/stdc++.h>
using i64 = long long;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int t;
  std::cin >> t;
  while (t--) {
    int n;
    std::cin >> n;
    n *= 2;
    std::vector<std::vector<int>> e(n);
    std::vector<std::tuple<int, int, int>> edges;
    for (int i = 0; i < n - 1; i++) {
      int u, v, w;
      std::cin >> u >> v >> w;
      u--;
      v--;
      e[u].push_back(v);
      e[v].push_back(u);
      edges.emplace_back(u, v, w);
    }
    std::vector<int> siz(n);
    std::function<void(int, int)> dfs = [&](int u, int p) {
      siz[u] = 1;
      for (auto v : e[u]) {
        if (v != p) {
          dfs(v, u);
          siz[u] += siz[v];
        }
      }
    };
    dfs(0, -1);
    i64 mn = 0, mx = 0;
    for (auto [u, v, w] : edges) {
      if (siz[v] > siz[u]) {
        std::swap(u, v);
      }
      mn += siz[v] % 2 * w;
      mx += std::min(siz[v], n - siz[v]) * i64(w);
    }
    std::cout << mn << " " << mx << "\n";
  }
  return 0;
}
