#include <bits/stdc++.h>
using namespace std;
int dfs2(int root, vector<list<pair<int, int> > > &adj, vector<bool> &visited,
         int total, long long &val, long long &val2) {
  visited[root] = true;
  int totnodes = 0;
  for (auto p : adj[root]) {
    int neigh = p.first;
    if (visited[neigh]) continue;
    int one = dfs2(neigh, adj, visited, total, val, val2);
    totnodes += one;
    if (one & 1) {
      val2 += p.second;
    }
    val += min(one, total - one) * ((long long)p.second);
  }
  return totnodes + 1;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long G = 0, B = 0;
    int k;
    cin >> k;
    vector<list<pair<int, int> > > adj(2 * k + 1);
    for (int i = 0; i < 2 * k - 1; i++) {
      int a, b, t;
      cin >> a >> b >> t;
      adj[a].push_back(make_pair(b, t));
      adj[b].push_back(make_pair(a, t));
    }
    vector<bool> visited1(2 * k + 1), visited2(2 * k + 1);
    dfs2(1, adj, visited1, 2 * k, B, G);
    cout << G << " " << B << "\n";
  }
  return 0;
}
