#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long quickpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int t, n;
const int N = 2e5 + 5;
vector<int> nxt[N], val[N];
long long mx, mn;
int cnt[N];
void dfs(int now, int fa, int len) {
  cnt[now] = 1;
  for (int i = 0; i < (int)nxt[now].size(); i++) {
    if (nxt[now][i] == fa) continue;
    dfs(nxt[now][i], now, val[now][i]);
    cnt[now] += cnt[nxt[now][i]];
  }
  mx += 1ll * min(cnt[now], 2 * n - cnt[now]) * len;
  for (int i = 0; i < (int)nxt[now].size(); i++) {
    if (nxt[now][i] == fa) continue;
    if (cnt[nxt[now][i]] & 1) mn += val[now][i];
  }
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= 2 * n; i++) {
      nxt[i].clear();
      val[i].clear();
    }
    mx = 0, mn = 0;
    int a, b, c;
    for (int i = 1; i < 2 * n; i++) {
      cin >> a >> b >> c;
      nxt[a].push_back(b);
      val[a].push_back(c);
      nxt[b].push_back(a);
      val[b].push_back(c);
    }
    dfs(1, 0, 0);
    cout << mn << " " << mx << endl;
  }
  return 0;
}
