#include <bits/stdc++.h>
struct str {
  long long node, cost;
};
long long t, k, min, max;
std::vector<str> graph[200005];
bool check[200005];
long long cnt[200005];
void parc(long long now);
int main() {
  std::cin >> t;
  while (t--) {
    std::cin >> k;
    min = max = 0;
    for (int i = 1; i <= 2 * k; ++i) {
      graph[i].clear();
      check[i] = false;
      cnt[i] = 1;
    }
    for (int i = 1; i < 2 * k; ++i) {
      long long x, y, z;
      std::cin >> x >> y >> z;
      graph[x].push_back({y, z});
      graph[y].push_back({x, z});
    }
    parc(1);
    std::cout << min << " " << max << "\n";
  }
  return 0;
}
void parc(long long now) {
  check[now] = true;
  if (!graph[now].size()) return;
  for (auto next : graph[now])
    if (!check[next.node]) {
      parc(next.node);
      max = max + next.cost * std::min(cnt[next.node], 2 * k - cnt[next.node]);
      min = min + next.cost * (cnt[next.node] % 2);
      cnt[now] += cnt[next.node];
    }
}
