#include <bits/stdc++.h>
using namespace std;
const int MAXN = 123456;
int n;
int mark[MAXN], rep[MAXN], Q[MAXN];
int e1[MAXN], e2[MAXN], g[MAXN], siz[MAXN], par[MAXN], big[MAXN], PAR[MAXN],
    comp[MAXN];
long long res[MAXN];
pair<int, int> a[MAXN];
pair<long long, int> ans[MAXN];
vector<int> adj[MAXN];
inline int root(int x) { return g[x] != x ? g[x] = root(g[x]) : g[x]; }
inline void Union(int x, int y) {
  if (siz[x] > siz[y]) swap(x, y);
  g[x] = y;
  siz[y] += siz[x];
  siz[x] = 0;
}
inline void dfs(int v, int id) {
  mark[v] = id;
  big[v] = siz[v];
  for (int i = 0; i < (int)adj[v].size(); i++) {
    int tmp = adj[v][i];
    if (mark[tmp] != id) {
      par[tmp] = v;
      PAR[tmp] = PAR[v];
      dfs(tmp, id);
      big[v] += big[tmp];
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &e1[i], &e2[i]);
    scanf("%d", &a[i].first);
    a[i].second = i;
  }
  sort(a + 1, a + n);
  for (int i = 1; i <= n; i++) {
    g[i] = i;
    siz[i] = 1;
  }
  for (int i = 1; i < n; true) {
    int j = i, len = 0;
    while (j < n && a[i].first == a[j].first) {
      int tmp = a[j].second;
      int x = root(e1[tmp]), y = root(e2[tmp]);
      if (rep[x] != i) {
        Q[len++] = x;
        adj[x].clear();
      }
      if (rep[y] != i) {
        Q[len++] = y;
        adj[y].clear();
      }
      rep[x] = rep[y] = i;
      adj[x].push_back(y);
      adj[y].push_back(x);
      j++;
    }
    for (int z = 0; z < len; z++)
      if (mark[Q[z]] != i) {
        par[Q[z]] = -1, PAR[Q[z]] = Q[z], comp[Q[z]] = 0;
        dfs(Q[z], i);
        comp[Q[z]] = big[Q[z]];
      }
    for (int z = i; z < j; z++) {
      int x = root(e1[a[z].second]);
      int y = root(e2[a[z].second]);
      if (par[x] == y)
        res[a[z].second] =
            2ll * (long long)big[x] * (long long)(comp[PAR[x]] - big[x]);
      else
        res[a[z].second] =
            2ll * (long long)big[y] * (long long)(comp[PAR[y]] - big[y]);
    }
    for (int z = i; z < j; z++)
      Union(root(e1[a[z].second]), root(e2[a[z].second]));
    i = j;
  }
  for (int i = 1; i < n; i++) {
    ans[i].first = -res[i];
    ans[i].second = i;
  }
  sort(ans + 1, ans + n);
  int cnt = 0;
  for (int i = 1; i < n; i++)
    if (ans[i].first == ans[1].first) cnt++;
  printf("%I64d %d\n", -ans[1].first, cnt);
  for (int i = 1; i <= cnt; i++) printf("%d ", ans[i].second);
  printf("\n");
  return 0;
}
