#include <bits/stdc++.h>
using namespace std;
struct Node {
  long long v;
  long long w;
  Node(long long v, long long w) {
    this->v = v;
    this->w = w;
  }
};
struct Res {
  long long min;
  long long max;
  Res(long long min, long long max) {
    this->min = min;
    this->max = max;
  }
  Res operator+(const Res& other) {
    return Res(min + other.min, max + other.max);
  }
  Res operator=(const Res& other) {
    this->min = other.min;
    this->max = other.max;
    return Res(this->min, this->max);
  }
};
Res bfs(long long p, vector<vector<Node> >& g, vector<long long>& size,
        vector<bool>& visited, long long k) {
  size[p] = 1;
  visited[p] = true;
  long long gp = 0;
  Res ret = Res(0, 0);
  for (long long i = 0; i < g[p].size(); i++) {
    long long v = g[p][i].v;
    if (visited[v] == false) {
      ret = ret + bfs(v, g, size, visited, k);
      size[p] += size[v];
    } else {
      gp = v;
    }
  }
  for (long long i = 0; i < g[p].size(); i++) {
    long long v = g[p][i].v;
    long long w = g[p][i].w;
    if (v != gp)
      ret = ret + Res(w * (size[v] % 2), w * min(size[v], 2 * k - size[v]));
  }
  return ret;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long k;
    cin >> k;
    vector<vector<Node> > g(2 * k + 10, vector<Node>());
    for (long long i = 0; i < 2 * k - 1; i++) {
      long long u, v, w;
      cin >> u >> v >> w;
      g[u].push_back(Node(v, w));
      g[v].push_back(Node(u, w));
    }
    vector<long long> size(2 * k + 10, 0);
    vector<bool> visited(2 * k + 10, false);
    Res res = bfs(1, g, size, visited, k);
    cout << res.min << " " << res.max << "\n";
  }
}
