#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int p[111000], r[111000], cnt[111000];
int getset(int v) { return p[v] == v ? v : (p[v] = getset(p[v])); }
void mergeset(int v, int u) {
  if (r[v] < r[u])
    p[v] = u, cnt[u] += cnt[v];
  else {
    p[u] = v;
    r[v] += r[u] == r[v];
    cnt[v] += cnt[u];
  }
}
int n;
pair<int, int> a[111000], b[111000];
vector<int> adj[111000];
int gli;
int chsum[111000], rootedge[111000], iter[111000];
long long d[111000];
vector<int> comp;
void dfs(int v) {
  comp.push_back(v);
  iter[v] = gli;
  chsum[v] = cnt[v];
  for (int i = 0, _n = ((int)(adj[v]).size()); i < _n; i++) {
    int e = adj[v][i];
    if (e == rootedge[v]) continue;
    int vv = v == a[e].first ? a[e].second : a[e].first;
    rootedge[vv] = e;
    dfs(vv);
    chsum[v] += chsum[vv];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0, _n = (n - 1); i < _n; i++) {
    scanf("%d%d%d", &a[i].first, &a[i].second, &b[i].first);
    a[i].first--;
    a[i].second--;
    b[i].second = i;
  }
  sort(b, b + n - 1);
  memset(chsum, -1, sizeof chsum);
  ;
  memset(rootedge, -1, sizeof rootedge);
  ;
  memset(iter, -1, sizeof iter);
  ;
  for (int i = 0, _n = (n); i < _n; i++) {
    cnt[i] = 1;
    p[i] = i;
    r[i] = 0;
  }
  for (int i1 = 0; i1 < n - 1;) {
    int ii = i1;
    vector<int> cur;
    while (i1 < n - 1 && b[i1].first == b[ii].first)
      cur.push_back(b[i1++].second);
    for (int j = 0, _n = ((int)(cur).size()); j < _n; j++) {
      a[cur[j]].first = getset(a[cur[j]].first);
      a[cur[j]].second = getset(a[cur[j]].second);
      adj[a[cur[j]].first].clear();
      adj[a[cur[j]].second].clear();
    }
    for (int j = 0, _n = ((int)(cur).size()); j < _n; j++) {
      adj[a[cur[j]].first].push_back(cur[j]);
      adj[a[cur[j]].second].push_back(cur[j]);
    }
    gli = i1;
    for (int j = 0, _n = ((int)(cur).size()); j < _n; j++)
      for (int jj = 0, _n = (2); jj < _n; jj++) {
        int v = jj ? a[cur[j]].first : a[cur[j]].second;
        if (iter[v] == gli) continue;
        comp.clear();
        dfs(v);
        for (int ii = 0, _n = ((int)(comp).size()); ii < _n; ii++) {
          int ver = comp[ii];
          if (ver == v) continue;
          d[rootedge[ver]] = chsum[ver] * (long long)(chsum[v] - chsum[ver]);
        }
      }
    for (int j = 0, _n = ((int)(cur).size()); j < _n; j++) {
      int x = getset(a[cur[j]].first);
      int y = getset(a[cur[j]].second);
      if (x != y) mergeset(x, y);
    }
  }
  long long mx = 0;
  for (int i = 0, _n = (n - 1); i < _n; i++) mx = max(mx, d[i]);
  vector<int> lst;
  for (int i = 0, _n = (n - 1); i < _n; i++)
    if (d[i] == mx) lst.push_back(i);
  cout << mx * 2 << " " << (int)(lst).size() << endl;
  for (int i = 0, _n = ((int)(lst).size()); i < _n; i++) {
    if (i) cout << " ";
    cout << (lst[i] + 1);
  }
  cout << endl;
  return 0;
}
