#include <bits/stdc++.h>
using namespace std;
vector<int> visited;
vector<vector<pair<int, int> > > cs;
long long resbad, resgood;
int isleft;
int visit(int i) {
  if (!visited[i]) {
    visited[i] = 1;
    for (auto j : cs[i]) {
      if (!visited[j.first]) {
        int ch = j.first;
        int c = j.second;
        int vch = visit(ch);
        while (vch > isleft - vch) {
          vch -= 2;
          isleft -= 2;
        }
        resgood += (vch % 2) * c;
        visited[i] += vch;
        int visbad = vch;
        resbad += (long long)vch * c;
      }
    }
  }
  return visited[i];
}
int main() {
  int(nbt);
  scanf("%d", &nbt);
  while (nbt--) {
    int(k);
    scanf("%d", &k);
    visited = vector<int>(2 * k, 0);
    cs = vector<vector<pair<int, int> > >(2 * k, vector<pair<int, int> >(0));
    for (int i = 0; i < (2 * k - 1); ++i) {
      int x, y, c;
      scanf("%d%d%d", &x, &y, &c);
      x--;
      y--;
      cs[x].push_back({y, c});
      cs[y].push_back({x, c});
    }
    resbad = 0;
    resgood = 0;
    isleft = 2 * k;
    visit(0);
    printf("%I64d %I64d\n", resgood, resbad);
  }
}
