#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
const int M = 1e4 + 7;
const int INF = 2e5 + 7;
const int MOD = 1e9 + 7;
const long long LINF = 1e17 + 7;
const double Pi = acos(-1.);
const double EPS = 1e-8;
struct Path {
  int s, t, w, id;
  bool operator<(const Path &p) const { return w < p.w; }
} p[N];
struct Edge {
  int s, t, id, next;
} e[N << 1];
int et, eh[N];
int n, vis[N];
long long f[N], g[N], siz[N], ans[N];
int root(int t) {
  int r, x = t;
  while (x != f[x]) x = f[x];
  r = x, x = t;
  while (x != f[x]) t = f[x], f[x] = r, x = t;
  return r;
}
void addEdge(int s, int t, int id) {
  e[et].s = s, e[et].t = t, e[et].id = id, e[et].next = eh[s], eh[s] = et++;
  e[et].s = t, e[et].t = s, e[et].id = id, e[et].next = eh[t], eh[t] = et++;
}
long long tot;
void dfs1(int u, int p = -1) {
  tot += g[u];
  siz[u] = g[u];
  vis[u] = true;
  for (int i = eh[u]; ~i; i = e[i].next) {
    int v = e[i].t;
    if (v == p) continue;
    dfs1(v, u);
    siz[u] += siz[v];
  }
}
void dfs2(int u, int p = -1) {
  for (int i = eh[u]; ~i; i = e[i].next) {
    int v = e[i].t;
    if (v == p) continue;
    ans[e[i].id] += (siz[v] * (tot - siz[v])) << 1;
    dfs2(v, u);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    g[i] = 1;
    f[i] = i;
    eh[i] = -1;
  }
  for (int i = 1; i < n; ++i) {
    p[i].id = i;
    scanf("%d%d%d", &p[i].s, &p[i].t, &p[i].w);
  }
  sort(p + 1, p + n);
  for (int i = 1; i < n;) {
    int j = i + 1;
    et = 0;
    addEdge(root(p[i].s), root(p[i].t), p[i].id);
    while (j < n && p[j].w == p[i].w) {
      addEdge(root(p[j].s), root(p[j].t), p[j].id);
      ++j;
    }
    for (int k = i; k < j; ++k)
      if (!vis[root(p[k].s)]) {
        tot = 0;
        dfs1(root(p[k].s));
        dfs2(root(p[k].s));
      }
    for (int k = i; k < j; ++k) {
      int rs = root(p[k].s), rt = root(p[k].t);
      eh[rs] = eh[rt] = -1;
      vis[rs] = vis[rt] = false;
      if (rs != rt) {
        f[rs] = rt;
        g[rt] += g[rs];
      }
    }
    i = j;
  }
  long long mv = -INF;
  int num = 0;
  for (int i = 1; i < n; ++i)
    if (ans[i] == mv) {
      ++num;
    } else if (ans[i] > mv) {
      mv = ans[i];
      num = 1;
    }
  printf("%I64d %d\n", mv, num);
  for (int i = 1; i < n; ++i)
    if (mv == ans[i]) {
      printf("%d\n", i);
    }
  return 0;
}
