#include <bits/stdc++.h>
using namespace std;
template <typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
  for (Tp current = _begin; current != _end; ++current) {
    std::cout << *current << _delim;
  }
  std::cout << '\n';
}
using ll = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);
vector<pii> gr[200000];
int tsize[200000];
void Dfs(int from, int p = -1) {
  tsize[from] = 1;
  for (auto [to, w] : gr[from]) {
    if (to != p) {
      Dfs(to, from);
      tsize[from] += tsize[to];
    }
  }
}
pair<ll, ll> Calc(int n) {
  ll res_max = 0;
  ll res_min = 0;
  for (int i = 0; i < (n); ++i) {
    for (auto [j, w] : gr[i]) {
      if (tsize[i] <= tsize[j]) {
        continue;
      }
      res_max += 1LL * w * min(n - tsize[j], tsize[j]);
      if (tsize[j] & 1) {
        res_min += w;
      }
    }
  }
  return {res_min, res_max};
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int qq;
  cin >> qq;
  while (qq--) {
    int k;
    cin >> k;
    const int n = k + k;
    for (int i = 0; i < (n); ++i) {
      gr[i].clear();
    }
    for (int i = 0; i < (n - 1); ++i) {
      int a, b, w;
      cin >> a >> b >> w;
      --a;
      --b;
      gr[a].emplace_back(b, w);
      gr[b].emplace_back(a, w);
    }
    Dfs(0);
    auto [ans_min, ans_max] = Calc(n);
    cout << ans_min << ' ' << ans_max << "\n";
  }
  return 0;
}
