#include <bits/stdc++.h>
using namespace std;
vector<long long> graph[200001], weight[200001];
long long size[200001], val[200001];
void dfs(long long start, long long par) {
  long long i, siz = graph[start].size();
  size[start] = 1;
  for (i = 0; i < siz; i++) {
    long long node = graph[start][i];
    if (node == par) continue;
    val[node] = weight[start][i];
    dfs(node, start);
    size[start] += size[node];
  }
}
void solve() {
  long long k, i, a, b, c, minans = 0, maxans = 0;
  cin >> k;
  k *= 2;
  for (i = 1; i <= k; i++) graph[i].clear(), weight[i].clear();
  for (i = 1; i < k; i++) {
    cin >> a >> b >> c;
    graph[a].push_back(b);
    graph[b].push_back(a);
    weight[a].push_back(c);
    weight[b].push_back(c);
  }
  dfs(1, -1);
  for (i = 2; i <= k; i++) {
    if (size[i] % 2) minans += val[i];
    maxans += min(size[i], k - size[i]) * val[i];
  }
  cout << minans << " " << maxans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
