#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
vector<pair<int, int> > v[N];
int pre[N];
long long sz[N];
int find(int x) {
  if (pre[x] == -1) return x;
  return pre[x] = find(pre[x]);
}
struct edge {
  int u, v, dis, id;
  void read(int _id) {
    id = _id;
    scanf("%d%d%d", &u, &v, &dis);
  }
  friend bool operator<(const edge &p, const edge &q) { return p.dis < q.dis; }
} e[N];
long long maxn;
int cnt, res[N];
long long dp[N];
int visit[N], times;
void dfs(int u) {
  visit[u] = times;
  for (int i = 0; i < v[u].size(); i++) {
    int x = v[u][i].first;
    if (visit[x] != times) {
      dfs(x);
      int id = v[u][i].second;
      if (maxn < dp[x] * (sz[find(x)] - dp[x])) {
        maxn = dp[x] * (sz[find(x)] - dp[x]);
        res[cnt = 1] = id;
      } else if (maxn == dp[x] * (sz[find(x)] - dp[x])) {
        res[++cnt] = id;
      }
      dp[u] += dp[x];
    }
  }
}
void solve(int st, int ed) {
  ++times;
  for (int i = st; i <= ed; i++) {
    e[i].u = find(e[i].u);
    e[i].v = find(e[i].v);
    v[e[i].u].clear();
    v[e[i].v].clear();
  }
  for (int i = st; i <= ed; i++) {
    v[e[i].v].push_back(make_pair(e[i].u, e[i].id));
    v[e[i].u].push_back(make_pair(e[i].v, e[i].id));
    dp[e[i].v] = sz[e[i].v];
    dp[e[i].u] = sz[e[i].u];
  }
  for (int i = st; i <= ed; i++) {
    int x = find(e[i].u);
    int y = find(e[i].v);
    pre[x] = y;
    sz[y] += sz[x];
  }
  for (int i = st; i <= ed; i++) {
    if (visit[e[i].v] != times) dfs(e[i].v);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) e[i].read(i);
  sort(e + 1, e + n);
  int i = 1;
  memset(pre, -1, sizeof(pre));
  fill(sz, sz + N, 1);
  while (i < n) {
    int j = i;
    while (j < n && e[j].dis == e[i].dis) j++;
    solve(i, j - 1);
    i = j;
  }
  sort(res + 1, res + cnt + 1);
  cout << maxn * 2 << " " << cnt << endl;
  for (int i = 1; i <= cnt; i++) printf("%d ", res[i]);
  printf("\n");
  return 0;
}
