#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
const long long int MAXN = 1e6 + 15, md = 1e9 + 7, inf = 2e9;
long long int tav(long long int n, long long int k) {
  long long int res = 1;
  while (k > 0) {
    if (k & 1) {
      res *= n;
      res %= md;
    }
    n *= n;
    n %= md;
    k >>= 1;
  }
  return res;
}
long long int ds[MAXN], dsz[MAXN];
long long int dsu(long long int v) {
  return (ds[v] == v ? v : ds[v] = dsu(ds[v]));
}
void merge(long long int v, long long int u) {
  v = dsu(v);
  u = dsu(u);
  if (v == u) return;
  dsz[v] += dsz[u];
  dsz[u] = 0;
  ds[u] = v;
  return;
}
vector<long long int> adj[MAXN], inv, res;
vector<pair<long long int, pair<long long int, long long int> > > temp;
vector<pair<pair<long long int, long long int>,
            pair<long long int, long long int> > >
    ed;
long long int ans[MAXN], z[MAXN], root, rt[MAXN], dep = 0, dis[MAXN];
bitset<MAXN> mark;
void DFS(long long int r, long long int par) {
  dis[r] = dep++;
  mark[r] = true;
  rt[r] = root;
  z[r] = dsz[r];
  for (auto i : adj[r]) {
    if (i == par) continue;
    DFS(i, r);
    z[r] += z[i];
  }
  dep--;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ed.push_back({{inf, 0}, {0, 0}});
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n - 1; i++) {
    long long int v, u, w;
    cin >> v >> u >> w;
    v--;
    u--;
    ed.push_back({{w, i}, {v, u}});
  }
  iota(ds, ds + n, 0);
  fill(dsz, dsz + n, 1);
  sort(ed.begin(), ed.end());
  long long int e = ed[0].first.first;
  for (long long int i = 0; i < n; i++) {
    if (ed[i].first.first == e) {
      long long int v = dsu(ed[i].second.first), u = dsu(ed[i].second.second);
      temp.push_back({ed[i].first.second, {v, u}});
      inv.push_back(v);
      inv.push_back(u);
      adj[v].push_back(u);
      adj[u].push_back(v);
      continue;
    }
    e = ed[i].first.first;
    for (auto j : inv) {
      if (mark[j]) continue;
      root = j;
      DFS(j, -1);
    }
    for (auto q : temp) {
      long long int v = q.second.first, u = q.second.second;
      merge(v, u);
      if (dis[v] < dis[u]) swap(v, u);
      ans[q.first] = 1ll * (z[rt[v]] - z[v]) * z[v];
    }
    for (auto j : inv) {
      mark[j] = false;
      adj[j].clear();
    }
    temp.clear();
    inv.clear();
    i--;
  }
  long long int m = -1;
  for (long long int i = 0; i < n - 1; i++) {
    if (ans[i] > m) {
      res.clear();
      m = ans[i];
    }
    if (ans[i] == m) {
      res.push_back(i + 1);
    }
  }
  cout << 2ll * m << ' ' << res.size() << '\n';
  for (auto i : res) {
    cout << i << ' ';
  }
  cout << '\n';
  return 0;
}
