#include <bits/stdc++.h>
using namespace std;
int remainedGood[200005];
int remainedBad[200005];
int subarb[200005];
long long good, bad;
vector<pair<int, int>> graph[200005];
void dfs(int node, int father, int distance, int n) {
  remainedGood[node] = remainedBad[node] = subarb[node] = 1;
  for (auto x : graph[node]) {
    if (x.first == father) continue;
    dfs(x.first, node, x.second, n);
    remainedGood[node] += remainedGood[x.first];
    remainedBad[node] += remainedBad[x.first];
    subarb[node] += subarb[x.first];
  }
  remainedGood[node] %= 2;
  good += 1LL * remainedGood[node] * distance;
  remainedBad[node] = min(remainedBad[node], n - subarb[node]);
  bad += 1LL * remainedBad[node] * distance;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    good = 0;
    bad = 0;
    int k;
    cin >> k;
    int n = 2 * k;
    for (int i = 1; i <= n; ++i) {
      remainedBad[i] = remainedGood[i] = subarb[i] = 0;
      graph[i].clear();
    }
    for (int i = 1; i < n; ++i) {
      int x, y, d;
      cin >> x >> y >> d;
      graph[x].emplace_back(y, d);
      graph[y].emplace_back(x, d);
    }
    dfs(1, -1, 0, n);
    cout << good << ' ' << bad << '\n';
  }
  return 0;
}
