#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 4;
struct Edge {
  int u, v, c;
  Edge(int _u, int _v, int _c) : u(_u), v(_v), c(_c) {}
};
vector<int> adj[N];
vector<Edge> edgeList;
int sz[N], n, par[N];
void init() {
  for (int i = 0; i <= n; ++i) adj[i].clear();
  edgeList.clear();
}
int dfs(int u, int p) {
  sz[u] = 1;
  par[u] = p;
  for (int c : adj[u]) {
    if (c != p) {
      sz[u] += dfs(c, u);
    }
  }
  return sz[u];
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    n *= 2;
    init();
    for (int i = 0; i < n - 1; ++i) {
      int u, v, c;
      cin >> u >> v >> c;
      edgeList.emplace_back(u, v, c);
      adj[u].push_back(v);
      adj[v].push_back(u);
    }
    long long ansMax = 0, ansMin = 0;
    dfs(1, -1);
    for (auto &e : edgeList) {
      int u = e.u, v = e.v, c = e.c;
      if (v == par[u]) swap(u, v);
      int sz1 = sz[v], sz2 = n - sz[v];
      ansMax += 1ll * c * min(sz1, sz2);
      ansMin += 1ll * c * min(sz1 % 2, sz2 % 2);
    }
    cout << ansMin << ' ' << ansMax << "\n";
  }
}
