#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
int n, u, v, w, t, p, sub[N], par[N], mark[N];
vector<pair<int, int> > g[N];
vector<pair<int, pair<int, int> > > edge[N];
pair<pair<int, int>, pair<int, int> > ed[N];
long long mx, ans[N];
set<int> s;
int Get_par(int u) {
  if (par[u] < 0) return u;
  return par[u] = Get_par(par[u]);
}
void merge(int u, int v) {
  u = Get_par(u), v = Get_par(v);
  if (par[v] < par[u]) swap(u, v);
  par[u] += par[v];
  par[v] = u;
}
void dfs1(int x) {
  sub[x] = par[x] * -1, mark[x] = 1;
  for (int i = 0; i < g[x].size(); i++)
    if (!mark[g[x][i].first]) dfs1(g[x][i].first), sub[x] += sub[g[x][i].first];
}
void dfs2(int x, int rt, int e) {
  mark[x] = 2;
  ans[e] = 1ll * sub[x] * (sub[rt] - sub[x]);
  for (int i = 0; i < g[x].size(); i++)
    if (mark[g[x][i].first] < 2) dfs2(g[x][i].first, rt, g[x][i].second);
}
int main() {
  fill(par, par + N, -1);
  cin >> n;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &ed[i].second.first, &ed[i].second.second);
    ;
    scanf("%d", &ed[i].first.first);
    ;
    ed[i].first.second = i;
  }
  sort(ed + 1, ed + n);
  for (int i = 1; i < n; i++) {
    if (i != 1 && ed[i].first.first != ed[i - 1].first.first) p++;
    edge[p].push_back(
        make_pair(ed[i].first.second,
                  make_pair(ed[i].second.first, ed[i].second.second)));
  }
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < edge[k].size(); i++) {
      edge[k][i].second.first = Get_par(edge[k][i].second.first),
      edge[k][i].second.second = Get_par(edge[k][i].second.second);
      g[edge[k][i].second.first].clear(), g[edge[k][i].second.second].clear();
    }
    for (int i = 0; i < edge[k].size(); i++)
      g[edge[k][i].second.first].push_back(
          make_pair(edge[k][i].second.second, edge[k][i].first)),
          g[edge[k][i].second.second].push_back(
              make_pair(edge[k][i].second.first, edge[k][i].first)),
          mark[edge[k][i].second.first] = mark[edge[k][i].second.second] = 0;
    for (int i = 0; i < edge[k].size(); i++)
      if (!mark[edge[k][i].second.first]) dfs1(edge[k][i].second.first);
    for (int i = 0; i < edge[k].size(); i++) {
      merge(edge[k][i].second.first, edge[k][i].second.second);
      if (mark[edge[k][i].second.first] < 2)
        dfs2(edge[k][i].second.first, edge[k][i].second.first, 0);
    }
  }
  for (int i = 1; i < n; i++) mx = max(mx, ans[i]);
  ;
  for (int i = 1; i < n; i++) t += (ans[i] == mx);
  cout << mx * 2 << " " << t << endl;
  for (int i = 1; i < n; i++)
    if (ans[i] == mx) cout << i << " ";
}
