#include <bits/stdc++.h>
using namespace std;
int k;
vector<vector<pair<long long, long long>>> adja_list;
vector<int> parent;
vector<long long> size_sub_tree;
long long min_ans, max_ans;
void dfs(int cur = 0, int cant = -1) {
  for (auto &[x, w] : adja_list[cur]) {
    if (x == cant) continue;
    parent[x] = cur;
    dfs(x, cur);
    size_sub_tree[cur] += size_sub_tree[x];
  }
}
void another_dfs(int cur = 0, int cant = -1) {
  for (auto &[x, w] : adja_list[cur]) {
    if (x == cant) continue;
    max_ans += w * min(size_sub_tree[x], 2 * k - size_sub_tree[x]);
    min_ans += (size_sub_tree[x] % 2) * w;
    another_dfs(x, cur);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    cin >> k;
    adja_list.assign(2 * k, vector<pair<long long, long long>>());
    parent.assign(2 * k, -1);
    size_sub_tree.assign(2 * k, 1);
    min_ans = 0;
    max_ans = 0;
    for (int i = 0; i < 2 * k - 1; i++) {
      int inp1, inp2, inp3;
      cin >> inp1 >> inp2 >> inp3;
      inp1--;
      inp2--;
      adja_list[inp1].emplace_back(inp2, inp3);
      adja_list[inp2].emplace_back(inp1, inp3);
    }
    dfs();
    another_dfs();
    cout << min_ans << ' ' << max_ans << '\n';
  }
}
