#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5 + 5;
int k;
long long mx, mn;
struct Edge {
  int to, nxt;
  long long w;
} e[MAX_N << 1];
int head[MAX_N], tote;
void add_edge(int u, int v, long long w) {
  e[++tote].to = v, e[tote].w = w, e[tote].nxt = head[u];
  head[u] = tote;
}
void init() {
  mn = mx = 0;
  memset(head, 0, sizeof(head)), tote = 0;
}
int siz[MAX_N];
void dfs(int u, int fa) {
  siz[u] = 1;
  for (int i = head[u]; i; i = e[i].nxt)
    if (e[i].to != fa) {
      dfs(e[i].to, u), siz[u] += siz[e[i].to];
      mx += min(2 * k - siz[e[i].to], siz[e[i].to]) * 1ll * e[i].w;
      if (siz[e[i].to] & 1) mn += e[i].w;
    }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    init();
    scanf("%d", &k);
    for (register int i = 1; i <= 2 * k - 1; i++) {
      int u, v;
      long long w;
      scanf("%d", &u), scanf("%d", &v), scanf("%lld", &w);
      add_edge(u, v, w), add_edge(v, u, w);
    }
    dfs(1, 1);
    printf("%lld %lld\n", mn, mx);
  }
  return 0;
}
