#include <bits/stdc++.h>
using namespace std;
struct EDGE {
  int u, v, ind;
  long long w;
};
const int N = 1000 * 100 + 100;
EDGE edge[N];
long long ans[N], dp[N], num, maxx;
int par[N], sz[N];
bool mark[N];
vector<pair<int, int> > adj[N];
vector<int> anss;
bool comp(EDGE a, EDGE b) {
  if (a.w < b.w) return 1;
  return 0;
}
void DFS(int v) {
  mark[v] = 1;
  num += sz[v];
  dp[v] = sz[v];
  for (int i = 0; i < (int)adj[v].size(); i++) {
    int u = adj[v][i].first;
    if (!mark[u]) {
      DFS(u);
      dp[v] += dp[u];
    }
  }
  mark[v] = 0;
  return;
}
void findans(int v) {
  mark[v] = 1;
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i].first, ind = adj[v][i].second;
    if (!mark[u]) {
      findans(u);
      ans[ind] = dp[u] * (num - dp[u]) * 2;
      maxx = max(maxx, ans[ind]);
    }
  }
  return;
}
int findpar(int v) {
  if (par[v] == -1) return v;
  return par[v] = findpar(par[v]);
}
void merge(int a, int b) {
  if (sz[a] > sz[b]) swap(a, b);
  sz[b] += sz[a];
  par[a] = b;
  return;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> edge[i].u >> edge[i].v >> edge[i].w;
    edge[i].ind = i;
  }
  sort(edge, edge + n - 1, comp);
  int pt1 = 0, pt2 = 0;
  fill(par, par + n + 5, -1);
  fill(sz, sz + n + 5, 1);
  while (pt1 < n - 1) {
    while (pt2 < n - 1 && edge[pt2].w == edge[pt1].w) {
      EDGE e = edge[pt2];
      int a = findpar(e.u);
      int b = findpar(e.v);
      adj[a].push_back(make_pair(b, e.ind));
      adj[b].push_back(make_pair(a, e.ind));
      pt2++;
    }
    for (int i = pt1; i < pt2; i++) {
      num = 0;
      int a = findpar(edge[i].v);
      if (!mark[a]) {
        DFS(a);
        findans(a);
      }
    }
    for (int i = pt1; i < pt2; i++) {
      EDGE e = edge[i];
      int a = findpar(e.u), b = findpar(e.v);
      mark[a] = 0;
      mark[b] = 0;
      adj[a].clear();
      adj[b].clear();
    }
    for (; pt1 < pt2; pt1++) {
      EDGE e = edge[pt1];
      int a = findpar(e.u), b = findpar(e.v);
      merge(a, b);
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (ans[i] == maxx) anss.push_back(i + 1);
  }
  cout << maxx << " " << anss.size() << endl;
  for (int i = 0; i < anss.size(); i++) cout << anss[i] << " ";
}
