#include <bits/stdc++.h>
using namespace std;
struct edge {
  int u, v, w, i;
  bool operator<(const edge &e) const { return (w < e.w); }
};
vector<edge> elist;
int pset[100005], sze[100005];
int findSet(int a) { return (a == pset[a] ? a : pset[a] = findSet(pset[a])); }
vector<pair<int, int> > edges[100005];
bool vst[100005];
int dfs(int u, int p) {
  int s = sze[u];
  for (auto v : edges[u]) {
    if (v.first == p) continue;
    s += dfs(v.first, u);
  }
  return s;
}
long long ans[100005], mx = 0;
int dfs2(int u, int p, int a) {
  vst[u] = true;
  int s = sze[u];
  for (auto v : edges[u]) {
    if (v.first == p) continue;
    int sub = dfs2(v.first, u, a);
    s += sub;
    ans[v.second] = 1LL * sub * (a - sub) * 2;
    mx = max(mx, ans[v.second]);
  }
  return s;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n - 1); i += (1)) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    edge e = {u, v, w, i};
    elist.push_back(e);
  }
  sort(elist.begin(), elist.end());
  for (int i = (1); i <= (n); i += (1)) pset[i] = i, sze[i] = 1;
  for (int i = (0); i <= (n - 2); i += (1)) {
    int j = i;
    vector<int> chge;
    --i;
    do {
      auto e = elist[++i];
      e.u = findSet(e.u);
      e.v = findSet(e.v);
      edges[e.u].push_back({e.v, e.i});
      edges[e.v].push_back({e.u, e.i});
      chge.push_back(e.u);
      chge.push_back(e.v);
    } while (i < n - 2 && elist[i].w == elist[i + 1].w);
    for (auto c : chge) {
      if (vst[c]) continue;
      int all = dfs(c, -1);
      dfs2(c, -1, all);
    }
    --j;
    do {
      auto e = elist[++j];
      e.u = findSet(e.u);
      e.v = findSet(e.v);
      pset[e.u] = e.v;
      sze[e.v] += sze[e.u];
    } while (j < n - 2 && elist[j].w == elist[j + 1].w);
    for (auto c : chge) {
      edges[c].clear();
      vst[c] = 0;
    }
  }
  vector<int> ids;
  for (int i = (1); i <= (n - 1); i += (1))
    if (ans[i] == mx) ids.push_back(i);
  printf("%lld %d\n", mx, (int)ids.size());
  for (auto i : ids) printf("%d ", i);
  printf("\n");
  return 0;
}
