#include <bits/stdc++.h>
using namespace std;
const int MAXN = 111 * 1000;
int par[MAXN], sz[MAXN];
int find(int i) {
  if (par[i] == i) return i;
  return par[i] = find(par[i]);
}
void un(int a, int b) {
  sz[find(a)] += sz[find(b)];
  par[find(b)] = find(a);
}
int n;
int mark[MAXN];
int sum[MAXN], tot[MAXN];
vector<int> adj[MAXN];
int dfs(int pos, int par = -1) {
  if (mark[pos]) return 0;
  mark[pos]++;
  for (__typeof((adj[pos]).begin()) it = (adj[pos]).begin();
       it != (adj[pos]).end(); ++it)
    if (*it != par) sum[pos] += dfs(*it, pos);
  return sum[pos];
}
void stot(int pos, int val) {
  if (mark[pos] != 1) return;
  mark[pos]++;
  tot[pos] = val;
  for (__typeof((adj[pos]).begin()) it = (adj[pos]).begin();
       it != (adj[pos]).end(); ++it)
    stot(*it, val);
}
int main() {
  for (register int i = (0); i < (int)(MAXN); ++i) par[i] = i, sz[i] = 1;
  cin >> n;
  vector<pair<pair<int, int>, pair<int, int> > > E(n - 1);
  for (register int i = (0); i < (int)(n - 1); ++i)
    cin >> E[i].second.first >> E[i].second.second >> E[i].first.first,
        E[i].second.first--, E[i].second.second--, E[i].first.second = i + 1;
  sort((E).begin(), (E).end());
  int lo = 0;
  long long mb = 0;
  vector<long long> res;
  while (lo < ((int)(E).size())) {
    int hi = lo;
    while (hi < ((int)(E).size()) && E[lo].first.first == E[hi].first.first)
      hi++;
    set<int> st;
    for (register int i = (lo); i < (int)(hi); ++i) {
      int x = find(E[i].second.first), y = find(E[i].second.second);
      if (x != y) {
        st.insert(x);
        st.insert(y);
        adj[x].push_back(y);
        adj[y].push_back(x);
        sum[x] = sz[x];
        sum[y] = sz[y];
      }
    }
    for (__typeof((st).begin()) it = (st).begin(); it != (st).end(); ++it) {
      if (!mark[*it]) {
        int tmp = dfs(*it);
        stot(*it, tmp);
      }
    }
    for (__typeof((st).begin()) it = (st).begin(); it != (st).end(); ++it)
      mark[*it] = false, adj[*it].clear();
    for (register int i = (lo); i < (int)(hi); ++i) {
      int x = E[i].second.first, y = E[i].second.second;
      if (find(x) == find(y)) continue;
      int mn = min(sum[find(x)], sum[find(y)]);
      long long cnt = 2LL * mn * (tot[find(x)] - mn);
      if (cnt > mb) {
        mb = cnt;
        res.clear();
      }
      if (cnt == mb) res.push_back(E[i].first.second);
    }
    for (register int i = (lo); i < (int)(hi); ++i) {
      int x = E[i].second.first, y = E[i].second.second;
      if (find(x) == find(y)) continue;
      un(x, y);
    }
    lo = hi;
  }
  cout << mb << " " << ((int)(res).size()) << endl;
  for (register int i = (0); i < (int)(((int)(res).size())); ++i)
    cout << res[i] << " ";
  cout << endl;
  return 0;
}
