#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int inf = 0x3f3f3f3f;
const int neginf = 0xC0C0C0C0;
using namespace std;
int n, dep[N], pa[N];
long long rk[N];
struct P {
  int u, v, w, id;
  long long cnt;
} p[N];
vector<int> e[N];
void dfs(int u, int f, int d) {
  dep[u] = d;
  for (int i = 0; i < (e[u].size()); ++i) {
    int v = e[u][i];
    if (v == f) continue;
    dfs(v, u, d + 1);
  }
}
bool cmp(P a, P b) {
  if (a.w != b.w) return a.w < b.w;
  return dep[a.u] > dep[b.u];
}
bool cmp1(P a, P b) {
  if (a.cnt != b.cnt) return a.cnt > b.cnt;
  return a.id < b.id;
}
int Find(int x) { return pa[x] = pa[x] == x ? x : Find(pa[x]); }
void Union(int x, int y) {
  x = Find(x), y = Find(y);
  if (x == y) return;
  pa[x] = y;
  rk[y] += rk[x];
}
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i < (n + 1); ++i) rk[i] = 1, pa[i] = i;
    for (int i = 1; i < (n + 1); ++i) e[i].clear();
    for (int i = 1; i < (n); ++i) {
      scanf("%d%d%d", &p[i].u, &p[i].v, &p[i].w);
      e[p[i].u].push_back(p[i].v);
      e[p[i].v].push_back(p[i].u);
      p[i].id = i;
    }
    dfs(1, -1, 1);
    for (int i = 1; i < (n + 1); ++i) {
      if (dep[p[i].u] < dep[p[i].v]) swap(p[i].u, p[i].v);
    }
    sort(p + 1, p + n, cmp);
    long long check;
    for (int i = 1; i < (n); ++i) {
      p[i].cnt = rk[Find(p[i].u)];
      Union(p[i].u, p[i].v);
      if (i == n - 1 || p[i].w != p[i + 1].w) {
        long long t = rk[Find(p[i].u)];
        for (int j = i; p[j].w == p[i].w; j--) {
          p[j].cnt *= rk[Find(p[j].u)] - p[j].cnt;
          if (p[j].id == 76621) check = p[j].cnt;
        }
      }
    }
    sort(p + 1, p + n, cmp1);
    int ans = 1;
    for (int i = 2; i < (n); ++i) {
      if (p[i].cnt != p[i - 1].cnt) {
        ans = i - 1;
        break;
      }
    }
    printf("%lld %d\n", p[1].cnt * 2, ans);
    for (int i = 1; i < (ans + 1); ++i) printf("%d ", p[i].id);
    printf("\n");
  }
  return 0;
}
