#include <bits/stdc++.h>
using namespace std;
int64_t seed;
mt19937 rng(seed = chrono::steady_clock::now().time_since_epoch().count());
inline int64_t rnd(int64_t l = 0, int64_t r = INT_MAX) {
  return uniform_int_distribution<int64_t>(l, r)(rng);
}
template <typename T, typename G>
ostream& operator<<(ostream& out, const pair<T, G>& a) {
  return out << "(" << a.first << " , " << a.second << ")";
}
template <typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
  out << "[";
  for (const auto& i : a) out << i << " , ";
  return out << "]" << endl;
}
template <typename T>
ostream& operator<<(ostream& out, const set<T>& a) {
  out << "{";
  for (const auto& i : a) out << i << " , ";
  return out << "}" << endl;
}
template <typename T, typename G>
ostream& operator<<(ostream& out, const map<T, G>& a) {
  out << "<";
  for (const auto& i : a) out << i << " , ";
  return out << ">" << endl;
}
template <typename T, size_t N>
typename enable_if<!is_same<typename remove_cv<T>::type, char>::value,
                   ostream&>::type
operator<<(ostream& out, T (&a)[N]) {
  out << '[';
  for (size_t i = 0; i < N; ++i) out << a[i] << " , ";
  out << "]" << endl;
  return out;
}
vector<vector<pair<int64_t, int64_t> > > adjlst;
int64_t mn = 0, mx = 0, n;
int64_t dfs(int64_t u, int64_t p) {
  int64_t sz = 1;
  for (auto v : adjlst[u]) {
    if (v.second == p) continue;
    int64_t tz = dfs(v.second, u);
    if (tz & 1) mn += v.first;
    mx += (min(tz, n - tz) * v.first);
    sz += tz;
  }
  return sz;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int64_t t;
  cin >> t;
  while (t--) {
    int64_t i, u, v, w;
    cin >> n;
    n *= 2;
    mn = 0, mx = 0;
    adjlst.assign(n + 1, vector<pair<int64_t, int64_t> >(0));
    for (i = 1; i < n; i++) {
      cin >> u >> v >> w;
      adjlst[u].push_back({w, v});
      adjlst[v].push_back({w, u});
    }
    dfs(1, 0);
    cout << mn << " " << mx << "\n";
  }
  return 0;
}
