#include <bits/stdc++.h>
using namespace std;
int p[100001], w[100001];
vector<pair<int, int>> e[100001];
long long ans[100001], sum;
int root(int x) {
  while (x != p[x]) x = p[x] = p[p[x]];
  return x;
}
void pre(int x, int from) {
  sum += w[x];
  for (auto c : e[x])
    if (c.first != from) pre(c.first, x);
}
int gao(int x, int from, int t) {
  int cnt = w[x];
  for (auto c : e[x]) {
    if (c.first == from) continue;
    cnt += gao(c.first, x, c.second);
  }
  e[x].clear();
  ans[t] = cnt * (sum - cnt) * 2;
  return cnt;
}
int main() {
  int n;
  scanf("%d", &n);
  map<int, vector<pair<pair<int, int>, int>>> u;
  for (int i = 1; i <= n; i++) w[p[i] = i] = 1;
  for (int i = 1; i != n; i++) {
    int x, y, c;
    scanf("%d%d%d", &x, &y, &c);
    u[c].push_back({{x, y}, i});
  }
  for (auto& r : u) {
    vector<int> v;
    for (auto c : r.second) {
      int x = root(c.first.first);
      int y = root(c.first.second);
      int t = c.second;
      e[x].push_back({y, t});
      e[y].push_back({x, t});
      v.push_back(x);
      v.push_back(y);
    }
    sort(v.begin(), v.end());
    v.resize(unique(v.begin(), v.end()) - v.begin());
    for (auto x : v)
      if (!e[x].empty()) {
        pre(x, sum = 0);
        gao(x, 0, 0);
      }
    for (auto c : r.second) {
      int x = root(c.first.first);
      int y = root(c.first.second);
      if (w[x] < w[y])
        w[p[x] = y] += w[x];
      else
        w[p[y] = x] += w[y];
    }
  }
  long long tmp = *max_element(ans + 1, ans + n);
  printf("%I64d %d\n", tmp, count(ans + 1, ans + n, tmp));
  for (int i = 1; i != n; i++)
    if (ans[i] == tmp) printf("%d ", i);
}
