#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int f[maxn], cnt[maxn];
pair<int, int> id[maxn];
pair<long long, int> res[maxn];
int a[maxn], b[maxn], aa[maxn], bb[maxn];
vector<int> tmp;
vector<int> e[maxn];
int cc[maxn], h[maxn];
int n;
int find(int u) {
  int v, w;
  for (v = u; f[v] != v; v = f[v])
    ;
  for (; f[u] != v;) {
    int w = f[u];
    f[u] = v;
    u = w;
  }
  return v;
}
void dfs(int u, int ff) {
  cc[u] = cnt[u];
  for (int v = 0; v < e[u].size(); v++)
    if (e[u][v] != ff) {
      h[e[u][v]] = h[u] + 1;
      dfs(e[u][v], u);
      cc[u] += cc[e[u][v]];
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int d;
    scanf("%d%d%d", &a[i], &b[i], &d);
    id[i] = make_pair(d, i);
  }
  for (int i = 1; i <= n; i++) f[i] = i, cnt[i] = 1;
  sort(id, id + n - 1);
  for (int i = 0, j; i < n - 1; i = j) {
    for (j = i; j < n - 1 && id[i].first == id[j].first; j++)
      ;
    tmp.clear();
    for (int k = i; k < j; k++) {
      aa[id[k].second] = find(a[id[k].second]);
      bb[id[k].second] = find(b[id[k].second]);
      tmp.push_back(aa[id[k].second]);
      tmp.push_back(bb[id[k].second]);
    }
    sort(tmp.begin(), tmp.end());
    tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
    for (int k = 0; k < tmp.size(); k++)
      e[tmp[k]].clear(), cc[tmp[k]] = h[tmp[k]] = 0;
    for (int k = i; k < j; k++) {
      e[aa[id[k].second]].push_back(bb[id[k].second]);
      e[bb[id[k].second]].push_back(aa[id[k].second]);
    }
    for (int k = 0; k < tmp.size(); k++)
      if (!h[tmp[k]]) {
        h[tmp[k]] = 1;
        dfs(tmp[k], 0);
      }
    for (int k = i; k < j; k++) {
      int u = find(a[id[k].second]);
      int v = find(b[id[k].second]);
      f[u] = v;
      cnt[v] += cnt[u];
    }
    for (int k = i; k < j; k++) {
      int o;
      if (h[aa[id[k].second]] < h[bb[id[k].second]])
        o = cc[bb[id[k].second]];
      else
        o = cc[aa[id[k].second]];
      int u = find(a[id[k].second]);
      res[id[k].second] = make_pair(-(long long)o * (cnt[u] - o), id[k].second);
    }
  }
  sort(res, res + n - 1);
  int c = 0;
  for (int i = 0; i < n - 1; i++) c += (res[i].first == res[0].first);
  printf("%I64d %d\n", -res[0].first * 2, c);
  for (int i = 0; i < c; i++)
    printf("%d%c", res[i].second + 1, i == c - 1 ? '\n' : ' ');
}
