#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double zero = 1e-8;
const double oo = 1e9 + 1;
const int maxn = 101010;
int A[maxn], B[maxn], C[maxn], o[maxn], f[maxn], n;
long long s[maxn], tree[maxn], z[maxn], pp[maxn], tot;
vector<int> v, e[maxn], r[maxn];
bool vis[maxn];
bool cmp(int i, int j) { return C[i] < C[j]; }
int seek(int x) {
  if (f[x] != x) f[x] = seek(f[x]);
  return f[x];
}
void dfs(int t, int l) {
  pp[t] = s[t];
  vis[t] = true;
  for (size_t j = 0; j < e[t].size(); ++j)
    if (e[t][j] != l) {
      dfs(e[t][j], t);
      z[r[t][j]] = pp[e[t][j]];
      pp[t] += pp[e[t][j]];
    }
  tot += s[t];
}
void mark(int t, int l) {
  for (size_t j = 0; j < e[t].size(); ++j)
    if (e[t][j] != l) {
      tree[r[t][j]] = (tot - pp[e[t][j]]) * pp[e[t][j]] * 2;
      mark(e[t][j], t);
    }
}
void work(const vector<int> &v) {
  for (size_t i = 0; i < v.size(); ++i) {
    int x = seek(A[v[i]]), y = seek(B[v[i]]);
    e[x].clear();
    e[y].clear();
    r[x].clear();
    r[y].clear();
    z[v[i]] = pp[x] = pp[y] = 0;
    vis[x] = vis[y] = false;
  }
  for (size_t i = 0; i < v.size(); ++i) {
    int x = f[A[v[i]]], y = f[B[v[i]]];
    e[x].push_back(y);
    e[y].push_back(x);
    r[x].push_back(v[i]);
    r[y].push_back(v[i]);
  }
  for (size_t i = 0; i < v.size(); ++i) {
    int x = f[A[v[i]]];
    if (!vis[x]) {
      tot = 0;
      dfs(x, -1);
      mark(x, -1);
    }
  }
  for (size_t i = 0; i < v.size(); ++i) {
    int x = seek(A[v[i]]), y = seek(B[v[i]]);
    if (x != y) {
      s[x] += s[y];
      f[y] = x;
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d%d", A + i, B + i, C + i);
    o[i] = i;
  }
  sort(o, o + n, cmp);
  for (int i = 1; i <= n; ++i) f[i] = i, s[i] = 1;
  for (int i = 1; i < n;) {
    int p = o[i];
    v.clear();
    while (i < n && C[o[i]] == C[p]) v.push_back(o[i++]);
    work(v);
  }
  long long ans = 0, cnt = 0;
  for (int i = 1; i < n; ++i) {
    if (tree[i] > ans) {
      ans = tree[i];
      cnt = 0;
    }
    if (tree[i] == ans) ++cnt;
  }
  cout << ans << ' ' << cnt << endl;
  for (int i = 1; i < n; ++i)
    if (tree[i] == ans) cout << i << ' ';
  return 0;
}
