#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int mul(int a, int b) { return ((a)*1ll * (b)) % mod; }
void add(int& a, int b) {
  a += b;
  if (a >= mod) a -= mod;
}
int sub(int a, int b) {
  a -= b;
  if (a < 0) {
    a += mod;
  }
  return a;
}
int powz(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) {
      res = mul(res, a);
    }
    b /= 2;
    a = mul(a, a);
  }
  return res;
}
template <typename A, typename B>
istream& operator>>(istream& input, pair<A, B>& x) {
  input >> x.first >> x.second;
  return input;
}
template <typename A>
istream& operator>>(istream& input, vector<A>& x) {
  for (auto& i : x) input >> i;
  return input;
}
template <typename A>
ostream& operator<<(ostream& output, vector<A>& x) {
  for (auto& i : x) output << i << ' ';
  return output;
}
const int N = 1000002;
vector<vector<pair<int, int>>> adj;
vector<int> sz;
vector<int> rv;
int m = 0;
void dfs(int u, int p) {
  rv[u] = m++;
  sz[u] = 1;
  for (auto i : adj[u]) {
    if (i.second == p) {
      continue;
    }
    dfs(i.second, u);
    sz[u] += sz[i.second];
  }
}
void solve() {
  int n;
  cin >> n;
  sz.clear();
  adj.clear();
  adj.resize(2 * n);
  sz.resize(2 * n);
  m = 0;
  vector<pair<int, pair<int, int>>> edges;
  for (int i = 0; i < 2 * n - 1; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    adj[x].push_back({z, y});
    adj[y].push_back({z, x});
    edges.push_back({z, {x, y}});
  }
  rv.clear();
  rv.resize(2 * n);
  dfs(0, -1);
  long long mn = 0, mx = 0;
  for (auto& i : edges) {
    if (rv[i.second.first] < rv[i.second.second]) {
      swap(i.second.first, i.second.second);
    }
    mn += ((sz[i.second.first] & 1)) * 1ll * (i.first);
    mx += min(sz[i.second.first], 2 * n - sz[i.second.first]) * 1ll * (i.first);
  }
  cout << mn << ' ' << mx;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tc = 1;
  cin >> tc;
  for (int _ = 0; _ < tc; _++) {
    solve();
    if (_ != tc - 1) cout << "\n";
  }
}
