#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long MOD = 1000000007;
vector<vector<pair<long long, long long> > > vec;
long long s[200005], mini = 0, maxi = 0, n;
void dfs(long long node, long long p) {
  s[node] = 1;
  for (auto it : vec[node])
    if (it.first != p) {
      dfs(it.first, node);
      if (s[it.first] & 1) mini += it.second;
      maxi += it.second * s[it.first];
      s[node] += s[it.first];
    }
}
long long find_centroid(long long node, long long p) {
  for (auto it : vec[node])
    if (it.first != p && s[it.first] > (n / 2))
      return find_centroid(it.first, node);
  return node;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long a, b, w;
    cin >> n;
    n <<= 1;
    vec.resize(n);
    for (long long i = 0; i < n - 1; ++i) {
      cin >> a >> b >> w;
      a--, b--;
      vec[a].push_back({b, w});
      vec[b].push_back({a, w});
    }
    dfs(0, 0);
    cout << mini << " ";
    long long r = find_centroid(0, 0);
    maxi = 0, dfs(r, r);
    cout << maxi << "\n";
    vec.clear(), mini = maxi = 0;
  }
  return 0;
}
