#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
int fa[MAXN], siz[MAXN];
int head[MAXN], V[MAXN * 2], Id[MAXN * 2], nxt[MAXN * 2], c;
struct edge {
  int u, v, d, id, step;
} e[MAXN];
bool cmp(edge a, edge b) {
  if (a.d == b.d) return a.step > b.step;
  return a.d < b.d;
}
int Find(int x) { return fa[x] == x ? x : fa[x] = Find(fa[x]); }
void AddEdge(int u, int v, int id) {
  c++;
  V[c] = v, Id[c] = id;
  nxt[c] = head[u];
  head[u] = c;
}
int Step[MAXN];
void dfs(int u, int p, int s) {
  for (int i = head[u]; i; i = nxt[i])
    if (V[i] != p) {
      Step[V[i]] = s;
      e[Id[i]].step = s;
      dfs(V[i], u, s + 1);
    }
}
long long ans;
int vec[MAXN];
int memo[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) fa[i] = i, siz[i] = 1;
  for (int i = 1; i < n; i++) {
    scanf("%d%d%d", &e[i].u, &e[i].v, &e[i].d), e[i].id = i;
    AddEdge(e[i].u, e[i].v, i);
    AddEdge(e[i].v, e[i].u, i);
  }
  dfs(1, 0, 1);
  sort(e + 1, e + n, cmp);
  int ls = 1, lc = e[1].d;
  for (int i = 1; i <= n; i++)
    if (e[i].d != lc) {
      int x, y;
      long long sx, sy;
      for (int j = ls; j < i; j++) {
        x = Find(e[j].u), y = Find(e[j].v);
        if (Step[x] > Step[y]) {
          siz[y] += siz[x];
          memo[j] = x;
          fa[x] = y;
        } else {
          siz[x] += siz[y];
          fa[y] = x;
          memo[j] = y;
        }
      }
      for (int j = ls; j < i; j++) {
        y = Find(e[j].v), x = memo[j];
        sx = siz[x], sy = siz[y] - siz[x];
        if (sx * sy > ans) {
          ans = sx * sy;
          vec[0] = 1, vec[1] = e[j].id;
        } else if (sx * sy == ans) {
          vec[0]++;
          vec[vec[0]] = e[j].id;
        }
      }
      ls = i, lc = e[i].d;
    }
  sort(vec + 1, vec + 1 + vec[0]);
  printf("%I64d %d\n%d", ans * 2, vec[0], vec[1]);
  for (int i = 2; i <= vec[0]; i++) printf(" %d", vec[i]);
  printf("\n");
}
