#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T qmin(const T a, const T b) {
  return a < b ? a : b;
}
template <typename T>
inline T qmax(const T a, const T b) {
  return a > b ? a : b;
}
template <typename T>
inline void getmin(T &a, const T b) {
  if (a > b) a = b;
}
template <typename T>
inline void getmax(T &a, const T b) {
  if (a < b) a = b;
}
inline void fileio(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = 1e9 + 7;
const long long linf = 1e17 + 7;
const int N = 1e5 + 7, M = N << 1;
struct Edge {
  int from, to, id, nxt;
  inline Edge() {}
  inline Edge(int _f, int _t, int _i, int _n)
      : from(_f), to(_t), id(_i), nxt(_n) {}
} e[M];
int edge;
int a[N], b[N], d[N], p[N];
int par[N], head[N], top[N], sz[N], used[N];
long long ans[N];
int node[N], cnt;
int n, cur;
inline int find(int x) { return par[x] < 0 ? x : par[x] = find(par[x]); }
inline void join(int x, int y) {
  x = find(x), y = find(y);
  if (x == y) return;
  if (par[x] < par[y])
    par[x] += par[y], par[y] = x;
  else
    par[y] += par[x], par[x] = y;
}
inline bool cmp(const int &x, const int &y) { return d[x] < d[y]; }
inline void connect(int id) {
  int x = find(a[id]), y = find(b[id]);
  if (used[x] != cur) used[x] = cur, head[x] = 0, node[++cnt] = x;
  if (used[y] != cur) used[y] = cur, head[y] = 0, node[++cnt] = y;
  e[++edge] = Edge(x, y, id, head[x]), head[x] = edge;
  e[++edge] = Edge(y, x, id, head[y]), head[y] = edge;
}
inline void getsz(int u, int from) {
  used[u] = cur, top[u] = from, sz[u] = -par[u];
  for (int p = head[u]; p; p = e[p].nxt) {
    int v = e[p].to;
    if (used[v] == cur) continue;
    getsz(v, from);
    sz[u] += sz[v];
  }
}
int main() {
  scanf("%d", &n);
  memset(par, -1, sizeof(int) * (n + 1));
  for (int i = 1; i < n; ++i) scanf("%d%d%d", a + i, b + i, d + i), p[i] = i;
  sort(p + 1, p + n, cmp);
  for (int i = 1, j; i < n; i = j) {
    edge = cnt = 0;
    ++cur;
    for (j = i; j < n && d[p[j]] == d[p[i]]; ++j) {
      connect(p[j]);
    }
    ++cur;
    for (int k = 1; k <= cnt; ++k) {
      if (used[node[k]] != cur) getsz(node[k], node[k]);
    }
    for (int p = 1; p <= edge; ++p) {
      int x = e[p].from, y = e[p].to;
      if (sz[x] < sz[y]) continue;
      ans[e[p].id] = (long long)sz[y] * (long long)(sz[top[y]] - sz[y]) << 1ll;
    }
    for (int k = i; k < j; ++k) join(a[p[k]], b[p[k]]);
  }
  long long mx = 0;
  static int ansid[N], tot;
  for (int i = 1; i < n; ++i) {
    if (ans[i] > mx)
      mx = ans[i], ansid[tot = 1] = i;
    else if (ans[i] == mx)
      ansid[++tot] = i;
  }
  printf("%I64d %d\n", mx, tot);
  for (int i = 1; i <= tot; ++i) printf("%d ", ansid[i]);
  puts("");
  return 0;
}
