#include <bits/stdc++.h>
using namespace std;
const int N = 200000;
int n, sz[N];
vector<array<int, 2>> adj[N];
long long mx, mn;
void dfs_size(int x, int pr) {
  sz[x] = 1;
  for (auto e : adj[x]) {
    if (e[0] != pr) {
      dfs_size(e[0], x);
      sz[x] += sz[e[0]];
      mx += (long long)min(sz[e[0]], n - sz[e[0]]) * e[1];
      mn += (long long)(sz[e[0]] % 2) * e[1];
    }
  }
}
void solve() {
  cin >> n;
  n *= 2;
  for (int i = 0; i < n; i++) {
    adj[i].clear();
  }
  mx = 0, mn = 0;
  for (int i = 0; i < n - 1; i++) {
    int x, y, t;
    cin >> x >> y >> t;
    x--, y--;
    adj[x].push_back({y, t});
    adj[y].push_back({x, t});
  }
  dfs_size(0, -1);
  cout << mn << ' ' << mx << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
