#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
int n;
vector<pair<int, long long>> edges[MAX];
long long subg[MAX];
long long solMax, solMin;
void dfs1(int a, int prev) {
  subg[a] = 1;
  for (auto e : edges[a]) {
    if (e.first == prev) continue;
    dfs1(e.first, a);
    subg[a] += subg[e.first];
  }
  return;
}
void dfs2(int a, int prev) {
  for (auto e : edges[a]) {
    if (e.first == prev) continue;
    long long x = min(subg[e.first], n - subg[e.first]);
    solMax += e.second * x;
    dfs2(e.first, a);
  }
  return;
}
void dfs3(int a, int prev) {
  for (auto e : edges[a]) {
    if (e.first == prev) continue;
    if (subg[e.first] % 2) solMin += e.second;
    dfs3(e.first, a);
  }
  return;
}
void solve() {
  int a, b;
  long long w;
  cin >> n;
  n *= 2;
  solMax = 0;
  solMin = 0;
  for (int i = 1; i <= n; i++) {
    edges[i].clear();
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b >> w;
    edges[a].push_back({b, w});
    edges[b].push_back({a, w});
  }
  dfs1(1, 0);
  dfs2(1, 0);
  dfs3(1, 0);
  cout << solMin << " " << solMax << "\n";
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
