#include <bits/stdc++.h>
using namespace std;
long long const MN = 1e5 + 100;
long long n, mx;
bool vis[MN];
set<long long> ver;
long long ans[MN], par[MN], sz[MN], syz[MN], res[MN];
vector<long long> pr, g[MN], vec3;
struct edge {
  long long U, V, Ind;
  edge() { U = V = Ind = 0; }
};
vector<edge> vec2;
map<long long, vector<edge> > mp;
void dfs(long long v) {
  vis[v] = 1;
  for (long long u : g[v]) {
    if (!vis[u]) {
      dfs(u);
      syz[v] += syz[u];
    }
  }
  vec3.push_back(v);
}
long long find(long long v) {
  if (par[v] < 0) return v;
  return par[v] = find(par[v]);
}
void merge(long long u, long long v) {
  if (sz[u] > sz[v]) swap(u, v);
  sz[v] += sz[u];
  par[u] = v;
}
int32_t main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  fill(par, par + MN, -1);
  fill(sz, sz + MN, 1);
  cin >> n;
  for (long long i = 0, w; i < n - 1; i++) {
    edge inp;
    inp.Ind = i;
    cin >> inp.U >> inp.V >> w;
    inp.U--, inp.V--;
    mp[w].push_back(inp);
  }
  for (auto vec : mp) {
    vec2.clear();
    ver.clear();
    for (auto e : vec.second) {
      long long u = find(e.U), v = find(e.V);
      if (u != v) {
        edge ne;
        ne.U = u, ne.V = v, ne.Ind = e.Ind;
        vec2.push_back(ne);
        ver.insert(u), ver.insert(v);
        g[u].push_back(v);
        g[v].push_back(u);
        syz[u] = sz[u];
        syz[v] = sz[v];
      }
    }
    for (auto v : ver) {
      if (!vis[v]) {
        dfs(v);
        for (auto u : vec3) res[u] = syz[v];
        vec3.clear();
      }
    }
    for (auto e : vec2) {
      long long u = find(e.U), v = find(e.V);
      merge(u, v);
    }
    for (auto e : vec2) {
      long long s = min(syz[e.U], syz[e.V]);
      ans[e.Ind] = s * (res[e.V] - s) * 2;
    }
    for (auto v : ver) {
      g[v].clear();
      res[v] = syz[v] = vis[v] = 0;
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    if (mx < ans[i]) {
      mx = ans[i];
      pr.clear();
    }
    if (ans[i] == mx) pr.push_back(i);
  }
  cout << mx << ' ' << pr.size() << '\n';
  for (auto i : pr) cout << i + 1 << ' ';
}
