#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;
template <typename T>
void DEBUG(string label, T value) {
  cerr << "[" << label << " = " << value << "]\n";
}
ll mx, mn, sum;
int n;
vector<vector<pair<int, int>>> adj;
vector<int> sz;
void dfs(int u, int p) {
  sz[u] = 1;
  for (auto nxt : adj[u]) {
    if (nxt.first != p) {
      dfs(nxt.first, u);
      sz[u] += sz[nxt.first];
      int k = min(sz[nxt.first], 2 * n - sz[nxt.first]);
      mx += 1LL * k * nxt.second;
      if (sz[nxt.first] % 2 == 0) {
        sum -= 1LL * nxt.second;
      }
    }
  }
}
void solve() {
  cin >> n;
  adj.assign(2 * n, vector<pair<int, int>>());
  sum = 0;
  for (int i = 0; i < 2 * n - 1; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    --a;
    --b;
    adj[a].push_back({b, c});
    adj[b].push_back({a, c});
    sum += c;
  }
  sz.assign(2 * n, 0);
  mx = 0;
  dfs(0, -1);
  cout << sum << " " << mx << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
