#include <bits/stdc++.h>
using namespace std;
long long md = 1000000007;
long long fact[100005], mi[100005], expt[100005];
long long pw(long long a, long long b) {
  long long c = 1, m = a;
  while (b) {
    if (b & 1) c = (c * m) % md;
    m = (m * m) % md;
    b /= 2;
  }
  return c;
}
long long modinv(long long n) { return pw(n, md - 2); }
inline long long add(long long a, long long b) { return (md + a + b) % md; }
inline long long subt(long long a, long long b) { return (a - b + md) % md; }
inline long long mult(long long a, long long b) { return (1ll * a * b) % md; }
long long ncr(int n, int r) {
  if (!n) return 1;
  return mult(fact[n], mult(mi[r], mi[n - r]));
}
void pre() {
  fact[0] = 1;
  for (int i = 1; i < 100003; i++) fact[i] = mult(i, fact[i - 1]);
  for (int i = 0; i < 100003; i++) mi[i] = modinv(fact[i]);
}
int myceil(int a, int b) {
  if (a % b)
    return (a / b) + 1;
  else
    return a / b;
};
vector<int> adj[200005];
typedef struct edge {
  long long u, v, c;
} edge;
long long numchild[200005];
void dfs(long long child, long long parent) {
  if (parent != -1) numchild[parent] += 1;
  for (auto i : adj[child])
    if (i != parent) dfs(i, child);
  if (parent != -1) numchild[parent] += numchild[child];
}
void solvetestcase(int tcn) {
  long long n;
  cin >> n;
  vector<edge> edges;
  for (int i = 0; i < 2 * n + 1; i++) {
    adj[i].clear();
    numchild[i] = 0;
  }
  for (int i = 0; i < 2 * n - 1; i++) {
    long long x, y, z;
    cin >> x >> y >> z;
    edge tmp = {x, y, z};
    edges.push_back(tmp);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, -1);
  long long mx, mn;
  mx = 0;
  mn = 0;
  for (int i = 0; i < 2 * n - 1; i++) {
    long long side1 = min(numchild[edges[i].u], numchild[edges[i].v]) + 1;
    long long side2 = 2 * n - side1;
    long long cost = edges[i].c;
    mx += cost * min(side1, side2);
    mn += cost * (side1 % 2);
  }
  cout << mn << " " << mx << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  cin >> t;
  for (int T = 1; T < t + 1; T++) {
    solvetestcase(T);
  }
};
