#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &u) {
  u = 0;
  char c = getchar();
  long long flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    u = (u << 3) + (u << 1) + (c ^ 48), c = getchar();
  if (flag) u = -u;
}
template <class T>
void write(T u) {
  if (u < 0) printf("-"), u = -u;
  if (u < 10)
    putchar(48 + u);
  else
    write(u / 10), putchar(48 + u % 10);
}
void write(char u) { putchar(u); }
template <class T, class... Arg>
void read(T &u, Arg &...v) {
  read(u);
  read(v...);
}
template <class T, class... Arg>
void write(T u, Arg... v) {
  write(u);
  write(v...);
}
template <class T>
bool checkmin(T &a, T b) {
  return (b < a ? a = b, 1 : 0);
}
template <class T>
bool checkmax(T &a, T b) {
  return (b > a ? a = b, 1 : 0);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T _max(T a, T b) {
  return (a > b ? a : b);
}
const long long N = 200005;
long long n, sz[N];
vector<pair<long long, long long> > G[N];
long long mx = 0, mn = 0;
void add_edge(long long x, long long y, long long z) {
  G[x].push_back(make_pair(y, z));
}
void dfs(long long x, long long f) {
  sz[x] = 1;
  for (long long i = 0; i < (long long)G[x].size(); ++i) {
    long long to = G[x][i].first;
    if (to == f) continue;
    dfs(to, x);
    sz[x] += sz[to];
  }
}
void init() {
  read(n);
  n <<= 1;
  for (long long i = 1; i <= n; ++i) {
    sz[i] = 0;
    G[i].clear();
  }
  for (long long i = 1, x, y, z; i < n; ++i) {
    read(x, y, z);
    add_edge(x, y, z);
    add_edge(y, x, z);
  }
  dfs(1, 0);
}
void run(long long x, long long f) {
  for (long long i = 0; i < (long long)G[x].size(); ++i) {
    long long to = G[x][i].first;
    if (to == f) continue;
    mx += G[x][i].second * _min(sz[to], n - sz[to]);
    mn += G[x][i].second * (sz[to] & 1);
    run(to, x);
  }
}
void solve() {
  mx = 0, mn = 0;
  run(1, 0);
  write(mn, ' ', mx, '\n');
}
int main() {
  int T = 1;
  read(T);
  while (T--) {
    init();
    solve();
  }
  return 0;
}
