#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int max_n = 200005;
vector<pair<int, int>> g[max_n];
int sz[max_n];
long long dis[max_n];
void dfs(int x) {
  sz[x] = 1;
  for (auto p : g[x]) {
    int u = p.first;
    if (sz[u]) continue;
    dis[u] = p.second;
    dfs(u);
    sz[x] += sz[u];
  }
}
void solve() {
  int n;
  cin >> n;
  n *= 2;
  for (int i = 0; i <= n; i++) g[i].clear();
  for (int i = 0; i <= n; i++) sz[i] = dis[i] = 0;
  for (int i = 1; i < n; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    g[u].push_back({v, w});
    g[v].push_back({u, w});
  }
  dfs(1);
  long long ans1 = 0, ans2 = 0;
  for (int i = 2; i <= n; i++) {
    if (sz[i] & 1) ans1 += dis[i];
    ans2 += min(sz[i], n - sz[i]) * dis[i];
  }
  cout << ans1 << " " << ans2 << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
