#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000 * 100 + 10;
int n, m, x, y, z;
int parent[MAX_N];
pair<int, int> edge[MAX_N], weight[MAX_N];
vector<pair<int, int> > v[MAX_N];
long long child[MAX_N], dist[MAX_N], cnt[MAX_N], check[MAX_N];
int find_par(int x) {
  if (parent[x] == x) return x;
  return parent[x] = find_par(parent[x]);
}
void merge(int x, int y) {
  int px = find_par(x), py = find_par(y);
  parent[px] = py;
  child[py] += child[px];
}
long long ras = 0;
void DFS(int x, int yal, int ch) {
  check[x] = ch;
  dist[x] = child[x];
  for (int i = 0; i < (int)v[x].size(); i++)
    if (check[v[x][i].first] != ch) {
      DFS(v[x][i].first, v[x][i].second, ch);
      dist[x] += dist[v[x][i].first];
    }
  if (yal != -1) cnt[yal] += max((ras - dist[x]) * (dist[x]) * 2, (long long)0);
}
int main() {
  cin >> n;
  m = n - 1;
  for (int i = 0; i < m; i++) {
    cin >> x >> y >> z;
    x--;
    y--;
    edge[i] = make_pair(x, y);
    weight[i] = make_pair(z, i);
  }
  sort(weight, weight + m);
  for (int i = 0; i < n; i++) {
    parent[i] = i;
    child[i] = (long long)1;
  }
  long long adad = 0;
  for (int i = 0; i < m; i++) {
    adad = i + 1;
    int w = weight[i].first;
    vector<pair<int, int> > edge2;
    while (i < m && weight[i].first == w) {
      edge2.push_back(weight[i]);
      i++;
    }
    i--;
    for (int j = 0; j < (int)edge2.size(); j++) {
      x = find_par(edge[edge2[j].second].first);
      y = find_par(edge[edge2[j].second].second);
      v[x].push_back(make_pair(y, edge2[j].second));
      v[y].push_back(make_pair(x, edge2[j].second));
    }
    for (int j = 0; j < (int)edge2.size(); j++)
      if (check[parent[edge[edge2[j].second].first]] != adad + m * 2) {
        DFS(parent[edge[edge2[j].second].first], -1, adad);
        ras = dist[parent[edge[edge2[j].second].first]];
        adad += m * 2;
        DFS(parent[edge[edge2[j].second].first], -1, adad);
        adad -= m * 2;
        ras = 0;
      }
    for (int j = 0; j < (int)edge2.size(); j++) {
      v[parent[edge[edge2[j].second].first]].clear();
      v[parent[edge[edge2[j].second].second]].clear();
    }
    for (int j = 0; j < (int)edge2.size(); j++)
      merge(edge[edge2[j].second].first, edge[edge2[j].second].second);
  }
  long long maxi = 0, tedad = 0;
  for (int i = 0; i < m; i++) maxi = max(maxi, cnt[i]);
  for (int i = 0; i < m; i++)
    if (cnt[i] == maxi) tedad++;
  cout << maxi << " " << tedad << endl;
  for (int i = 0; i < m; i++)
    if (cnt[i] == maxi) cout << i + 1 << " ";
  cout << endl;
  return 0;
}
