#include <bits/stdc++.h>
using namespace std;
const int N = 500023;
bool vis[N];
vector<long long int> adj[N];
long long int subtree[N];
void dfs(int curr) {
  vis[curr] = 1;
  subtree[curr] = 1;
  for (int i : adj[curr]) {
    if (vis[i]) continue;
    dfs(i);
    subtree[curr] += subtree[i];
  }
}
void solve() {
  long long int k;
  cin >> k;
  vector<pair<pair<long long int, long long int>, long long int>> edges;
  for (int i = 1; i <= 2 * k; i++) {
    subtree[i] = 0;
    vis[i] = 0;
    adj[i].clear();
  }
  for (long long int i = 0; i < 2 * k - 1; i++) {
    long long int a, b, c;
    cin >> a >> b >> c;
    adj[a].push_back(b);
    adj[b].push_back(a);
    edges.push_back(make_pair(make_pair(a, b), c));
  }
  dfs(1);
  long long int good = 0;
  long long int bad = 0;
  for (auto p : edges) {
    long long int a = subtree[p.first.first];
    long long int b = subtree[p.first.second];
    long long int mini = min(min(a, b), 2 * k - min(a, b));
    long long int weight = p.second;
    if (mini % 2 == 1) good += weight;
    bad += (weight * mini);
  }
  cout << good << ' ' << bad << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  cin >> T;
  int t = 0;
  while (t++ < T) {
    solve();
  }
}
