#include <bits/stdc++.h>
using namespace std;
long long n, vis[2000], x[300300], y[300300], z[300300], sz[300300];
bool stop = 0;
vector<long long> g[300200];
void dfs(int u = 1, int p = 0) {
  for (int i = 0; i < g[u].size(); i++) {
    if (g[u][i] == p) continue;
    dfs(g[u][i], u);
    sz[u] += sz[g[u][i]];
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    n *= 2;
    for (int i = 1; i <= n; i++) {
      g[i].clear();
      sz[i] = 1;
    }
    for (int i = 1; i < n; i++) {
      cin >> x[i] >> y[i] >> z[i];
      g[x[i]].push_back(y[i]);
      g[y[i]].push_back(x[i]);
    }
    dfs();
    long long mn = 0, mx = 0;
    for (int i = 1; i < n; i++) {
      if (sz[x[i]] > sz[y[i]]) swap(x[i], y[i]);
      mn += (sz[x[i]] % 2) * z[i];
      mx += min(sz[x[i]], n - sz[x[i]]) * z[i];
    }
    cout << mn << " " << mx << "\n";
  }
  return 0;
}
