#include <bits/stdc++.h>
using namespace std;
namespace RKK {
const int N = 200011;
struct sumireko {
  int to, ne, w;
} e[N << 1];
int he[N], ecnt;
void addline(int f, int t, int w) {
  e[++ecnt].to = t;
  e[ecnt].w = w;
  e[ecnt].ne = he[f];
  he[f] = ecnt;
}
int qaq, n, size[N];
long long ans1, ans2;
void dfs(int x, int f = 0) {
  size[x] = 1;
  for (int i = he[x], t = e[i].to; i; i = e[i].ne, t = e[i].to)
    if (t != f) {
      dfs(t, x), size[x] += size[t];
      ans1 += e[i].w * (size[t] & 1);
      ans2 += 1ll * e[i].w * min(size[t], n - size[t]);
    }
}
int maid() {
  scanf("%d", &qaq);
  while (qaq--) {
    scanf("%d", &n);
    n *= 2;
    for (int i = 1, x, y, w; i < n; i++)
      scanf("%d%d%d", &x, &y, &w), addline(x, y, w), addline(y, x, w);
    dfs(1);
    printf("%lld %lld\n", ans1, ans2);
    for (int i = 1; i <= n; i++) he[i] = 0;
    ecnt = 0, ans1 = ans2 = 0;
  }
  return 0;
}
}  // namespace RKK
int main() { return RKK::maid(); }
