#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n;
int num;
int head[maxn];
long long siz[maxn];
bool vis[maxn];
long long Min, Max;
struct Edge {
  int u, v, next;
  long long w;
} edge[maxn << 1];
void add_edge(int u, int v, long long w) {
  edge[num].v = v;
  edge[num].w = w;
  edge[num].next = head[u];
  head[u] = num++;
}
void dfs(int u) {
  siz[u] = 1;
  vis[u] = 1;
  for (int i = head[u]; i != -1; i = edge[i].next) {
    int v = edge[i].v;
    long long w = edge[i].w;
    if (vis[v]) continue;
    dfs(v);
    siz[u] += siz[v];
    long long siz1 = siz[v], siz2 = n - siz1;
    Min += (siz1 % 2) * w;
    Max += min(siz1, siz2) * w;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    num = 0;
    cin >> n, n <<= 1;
    for (int i = 1; i <= n; i++) head[i] = -1, siz[i] = vis[i] = 0;
    for (int i = 1; i <= n - 1; i++) {
      int u, v;
      long long w;
      cin >> u >> v >> w;
      add_edge(u, v, w);
      add_edge(v, u, w);
    }
    Min = Max = 0;
    dfs(1);
    cout << Min << ' ' << Max << '\n';
  }
  return 0;
}
