#include <bits/stdc++.h>
int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int oo = INT_MAX;
const long long int OO = 1e18;
const int monthly[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int alldx[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int alldy[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0};
const int dz[] = {0, 0, 0, 0, 1, -1};
using namespace std;
string Letters = "0123456789ABCDEF";
int toInt(char c) { return Letters.find(c); }
long long int FromAnyBaseToDecimal(string inp, int base) {
  long long int ans = 0;
  for (long long int i = (0) - ((0) > (inp.size()));
       i != (inp.size()) - ((0) > (inp.size()));
       i += 1 - 2 * ((0) > (inp.size()))) {
    ans *= base;
    ans += toInt(inp[i]);
  }
  return ans;
}
string FromDecimalToAnyBase(long long int n, int base) {
  if (n == 0) return "0";
  string ans = "";
  while (n) {
    ans = Letters[n % base] + ans;
    n /= base;
  }
  return ans;
}
long long int GCD(long long int a, long long int b) {
  return ((!b) ? a : GCD(b, a % b));
}
long long int LCM(long long int a, long long int b) {
  return a / (GCD(a, b)) * b;
}
long long int nCr(long long int n, long long int r) {
  if (n < r) return 0;
  if (r == 0) return 1;
  return n * nCr(n - 1, r - 1) / r;
}
long long int PowMod(long long int bs, long long int ex, long long int M) {
  if (!ex) return 1;
  long long int p = PowMod((bs * bs) % M, ex >> 1, M);
  return (ex & 1) ? (p * bs) % M : p;
}
long long int fastpow(long long int b, long long int e) {
  if (!e) return 1;
  if (e & 1) return b * fastpow(b, e - 1);
  long long int x = fastpow(b, e / 2);
  return x * x;
}
long long int ModInverse(long long int a) { return PowMod(a, MOD - 2, MOD); }
long long int ExtGCD(long long int a, long long int b, long long int& x,
                     long long int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return a;
  }
  long long int r = ExtGCD(b, a % b, y, x);
  y -= a / b * x;
  return r;
}
long long int mult(long long int a, long long int b) {
  return (1LL * a * b) % MOD;
}
long long int SumOfOdd(long long int l, long long int r) {
  long long int Rsm = (r + 1) / 2;
  Rsm *= Rsm;
  l--;
  long long int Lsm = (l + 1) / 2;
  Lsm *= Lsm;
  return Rsm - Lsm;
}
long long int NoOfOdd(long long int L, long long int R) {
  long long int N = (R - L) / 2;
  if (R % 2 != 0 || L % 2 != 0) N++;
  return N;
}
long long int NoOfEven(long long int L, long long int R) {
  return ((R - L + 1) - NoOfOdd(L, R));
}
bool PointInRectangle(long long int x1, long long int y1, long long int x2,
                      long long int y2, long long int x, long long int y) {
  return (x >= x1 && x <= x2 && y >= y1 && y <= y2);
}
bool isPrime(long long int n) {
  if (n == 2) return 1;
  if (n < 2 || n % 2 == 0) return 0;
  for (long long int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return 0;
  return 1;
}
bool isPalindrome(string str) {
  long long int l = 0;
  long long int h = str.size() - 1;
  while (h > l) {
    if (str[l++] != str[h--]) {
      return 0;
    }
  }
  return 1;
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool isPerfectCube(long long int n) {
  long long int curoot = round(pow(n, 1.0 / 3.0));
  return (pow(curoot, 3) == n);
}
double distance(double x1, double y1, double x2, double y2) {
  return hypot(fabs(x1 - x2), fabs(y1 - y2));
}
const long long int NN = 4e5 + 5;
long long int t, k, n, K = 1e18;
long long int d[202020][2], h2, subi[202020];
vector<long long int> v[202020];
vector<long long int> aa[202020];
long long int Solve(long long int it, long long int parent, long long int p) {
  long long int ret = d[it][parent];
  if (ret == -1) {
    long long int jj = 0, hz = 0, hi = 1e18;
    vector<long long int> isi;
    for (long long int i = 0; i < v[it].size(); i++) {
      if (v[it][i] == p) continue;
      jj += min(Solve(v[it][i], 0, it), Solve(v[it][i], 1, it) + aa[it][i]);
      if (Solve(v[it][i], 0, it) > Solve(v[it][i], 1, it) + aa[it][i]) hz++;
      hi = min(hi, abs(Solve(v[it][i], 0, it) -
                       (Solve(v[it][i], 1, it) + aa[it][i])));
    }
    if ((hz % 2) == parent) jj += hi;
    ret = jj;
  }
  return d[it][parent] = ret;
}
void Run_DFS(long long int it, long long int p) {
  subi[it] = 1;
  for (long long int i = 0; i < v[it].size(); i++) {
    if (v[it][i] == p) continue;
    Run_DFS(v[it][i], it);
    subi[it] += subi[v[it][i]];
  }
  for (long long int i = (0) - ((0) > (v[it].size()));
       i != (v[it].size()) - ((0) > (v[it].size()));
       i += 1 - 2 * ((0) > (v[it].size()))) {
    if (v[it][i] == p) continue;
    h2 += aa[it][i] * min(subi[v[it][i]], n - subi[v[it][i]]);
  }
}
void GETAC() {
  cin >> k;
  n = k * 2;
  h2 = 0;
  for (long long int i = 1; i <= n; i++) {
    v[i].clear();
    aa[i].clear();
    d[i][0] = -1;
    d[i][1] = -1;
  }
  for (long long int i = (1) - ((1) > (n)); i != (n) - ((1) > (n));
       i += 1 - 2 * ((1) > (n))) {
    long long int ta, tb, tc;
    cin >> ta >> tb >> tc;
    v[ta].push_back(tb);
    v[tb].push_back(ta);
    aa[ta].push_back(tc);
    aa[tb].push_back(tc);
  }
  Run_DFS(1, 1);
  cout << Solve(1, 0, 1) << " " << h2 << "\n";
}
int main() {
  ios_base::sync_with_stdio(0), ios::sync_with_stdio(0), cin.tie(0),
      cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    GETAC();
  }
}
