#include <bits/stdc++.h>
using namespace std;
template <typename T, typename V>
inline void bugp(const pair<T, V> &x) {
  cerr << '{' << x.first << ", " << x.second << '}' << endl;
}
template <typename T, typename U, typename V>
inline void bugpp(const pair<T, pair<U, V> > &x) {
  cerr << '{' << x.first << ", {" << x.second.first << ", " << x.second.second
       << "}}" << endl;
}
const int N = 200002;
int n, subsz[N];
long long mx, mn;
vector<pair<int, int> > G[N];
void DFS(int u, int par) {
  subsz[u] = 1;
  for (pair<int, int> &v : G[u]) {
    if (v.second == par) continue;
    DFS(v.second, u);
    subsz[u] += subsz[v.second];
    mx += (long long)v.first * min(subsz[v.second], n - subsz[v.second]);
    mn += (long long)v.first * (subsz[v.second] & 1);
  }
}
void input() {
  cin >> n;
  n <<= 1;
  for (int i = 1, _n = (n); i <= _n; ++i) G[i].clear();
  int a, b, t;
  for (int i = 1, _n = (n - 1); i <= _n; ++i) {
    cin >> a >> b >> t;
    G[a].push_back({t, b});
    G[b].push_back({t, a});
  }
}
void solve() {
  mx = mn = 0;
  DFS(1, 1);
  cout << mn << ' ' << mx << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int test;
  cin >> test;
  while (test--) {
    input();
    solve();
  }
  return 0;
}
