#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
struct edge {
  int v, u;
  int w;
  int id;
  long long cnt = 0ll;
};
auto comp = [](const edge& a, const edge& b) { return a.w < b.w; };
int p[MAXN];
int sz[MAXN];
int tsz[MAXN];
bool used[MAXN];
int root[MAXN];
int n;
edge e[MAXN];
vector<int> gr[MAXN];
set<int> kek;
int find_set(int v) { return (v == p[v]) ? v : p[v] = find_set(p[v]); }
void unite(int v, int u) {
  v = find_set(p[v]);
  u = find_set(p[u]);
  if (v == u) return;
  if (sz[v] > sz[u]) swap(v, u);
  p[v] = u;
  sz[u] += sz[v];
}
int sum;
void dfs(int v, int pr, int rt) {
  tsz[v] = sz[v];
  used[v] = true;
  root[v] = rt;
  for (auto u : gr[v]) {
    if (u == pr) continue;
    dfs(u, v, rt);
    tsz[v] += tsz[u];
  }
}
void solve(int l, int r) {
  sum = 0;
  kek.clear();
  for (auto i = l; i != r + 1; i++) {
    int v = find_set(e[i].v);
    int u = find_set(e[i].u);
    tsz[v] = tsz[u] = 0;
    used[v] = used[u] = false;
    gr[v].push_back(u);
    gr[u].push_back(v);
    if (!kek.count(v)) {
      kek.insert(v);
    }
    if (!kek.count(u)) {
      kek.insert(u);
    }
  }
  for (auto v : kek) {
    if (!used[v]) dfs(v, -1, v);
  }
  for (auto i = l; i != r + 1; i++) {
    int v = find_set(e[i].v);
    int u = find_set(e[i].u);
    if (tsz[v] > tsz[u]) swap(v, u);
    e[i].cnt = 2 * tsz[v] * 1ll * (tsz[root[v]] - tsz[v]);
    gr[v].clear();
    gr[u].clear();
  }
  for (auto i = l; i != r + 1; i++) unite(find_set(e[i].v), find_set(e[i].u));
}
set<int> lol;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(tsz, 0, sizeof(tsz));
  scanf("%d", &n);
  for (auto i = 0; i != n; i++) {
    p[i] = i;
    sz[i] = 1;
  }
  for (auto i = 0; i != n - 1; i++) {
    scanf("%d%d%d", &e[i].v, &e[i].u, &e[i].w);
    e[i].v--;
    e[i].u--;
    e[i].id = i;
  }
  sort(e, e + n - 1, comp);
  int l = 0;
  for (auto i = 0; i != n - 1; i++) {
    if (i < n - 2 && e[i].w == e[i + 1].w) continue;
    solve(l, i);
    l = i + 1;
  }
  long long best = -1;
  for (auto i = 0; i != n - 1; i++) {
    if (e[i].cnt > best) {
      best = e[i].cnt;
      lol.clear();
    }
    if (e[i].cnt == best) lol.insert(e[i].id);
  }
  printf("%lld %d\n", best, (int)lol.size());
  for (auto v : lol) printf("%d ", v + 1);
  return 0;
}
