#include <bits/stdc++.h>
using namespace std;
const int maxN = 101000;
struct edge {
  int x, y, z, id;
} e[maxN];
long long res[maxN];
int dp[maxN];
int fa[maxN];
bool vis[maxN];
int px[maxN], py[maxN];
int tt, g[maxN], nxt[maxN * 2], pt[maxN * 2];
int n;
int root[maxN];
bool cmp1(const edge &a, const edge &b) { return a.z < b.z; }
void add(int a, int b) {
  pt[++tt] = b;
  nxt[tt] = g[a];
  g[a] = tt;
}
int find(int x) {
  if (fa[x] < 0)
    return x;
  else
    fa[x] = find(fa[x]);
  return fa[x];
}
void print() {
  long long ans = 0;
  for (int i = 1; i < n; ++i)
    if (res[i] > ans) ans = res[i];
  int cnt = 0;
  for (int i = 1; i < n; ++i)
    if (res[i] == ans) cnt++;
  printf("%I64d %d\n", ans, cnt);
  for (int i = 1; i < n; ++i)
    if (res[i] == ans) printf("%d ", i);
  puts("");
}
void dfs(int x, int rt) {
  vis[x] = 1;
  root[x] = rt;
  int idx = g[x];
  while (idx > 0) {
    int y = pt[idx];
    if (!vis[y]) {
      dfs(y, rt);
      dp[x] += dp[y];
    }
    idx = nxt[idx];
  }
  dp[x] += -fa[x];
}
void solve() {
  for (int i = 1; i <= n; ++i) fa[i] = -1;
  int i = 1;
  while (i < n) {
    int le = i;
    while (i + 1 < n && e[i + 1].z == e[i].z) i++;
    int ri = i;
    i++;
    tt = 0;
    for (int j = le; j <= ri; ++j) {
      px[j] = find(e[j].x);
      py[j] = find(e[j].y);
      vis[px[j]] = vis[py[j]] = 0;
      g[px[j]] = g[py[j]] = 0;
      dp[px[j]] = dp[py[j]] = 0;
    }
    for (int j = le; j <= ri; ++j) {
      if (px[j] == py[j]) continue;
      add(px[j], py[j]);
      add(py[j], px[j]);
    }
    for (int j = le; j <= ri; ++j)
      if (!vis[px[j]]) dfs(px[j], px[j]);
    for (int j = le; j <= ri; ++j) {
      long long sumson = min(dp[px[j]], dp[py[j]]);
      long long sumfa = dp[root[px[j]]] - sumson;
      res[e[j].id] = (long long)2 * sumson * sumfa;
    }
    for (int j = le; j <= ri; ++j) {
      int a = find(e[j].x);
      int b = find(e[j].y);
      fa[a] += fa[b];
      fa[b] = a;
    }
  }
}
void init() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d%d", &e[i].x, &e[i].y, &e[i].z);
    e[i].id = i;
  }
  sort(e + 1, e + n, cmp1);
}
int main() {
  init();
  solve();
  print();
  return 0;
}
