#include <bits/stdc++.h>
using namespace std;
long long r[100010];
long long n;
long long total;
long long ptr[100010];
long long comp_size[100010];
struct half_edge {
  long long v;
  long long num;
};
vector<half_edge> a[100010];
long long temp_v[100010];
long long dfs_size[100010];
bool mark[100010];
bool mark2[100010];
struct edge {
  long long v1;
  long long v2;
  long long wt;
  long long num;
};
bool operator<(edge c, edge d) {
  if (c.wt < d.wt)
    return true;
  else
    return false;
}
edge e[100010];
long long e_trees[100010];
long long src(long long x) {
  long long tx = x, sx, temp;
  while (ptr[tx] != tx) {
    tx = ptr[tx];
  }
  sx = tx;
  tx = x;
  while (tx != sx) {
    temp = ptr[tx];
    ptr[tx] = sx;
    tx = temp;
  }
  return sx;
}
void dsu_add(long long i) {
  long long sx = src(e[i].v1), sy = src(e[i].v2);
  e_trees[e[i].num] = 2 * comp_size[sx] * comp_size[sy];
  ptr[max(sx, sy)] = min(sx, sy);
  comp_size[min(sx, sy)] += comp_size[max(sx, sy)];
  comp_size[max(sx, sy)] = 0;
}
void count_total(long long c) {
  mark2[c] = 1;
  dfs_size[c] = comp_size[c];
  long long i;
  for (i = 0; i < a[c].size(); i++) {
    if (mark2[a[c][i].v] == 0) {
      count_total(a[c][i].v);
      dfs_size[c] += dfs_size[a[c][i].v];
    }
  }
}
void cdfs(long long c) {
  mark[c] = 1;
  long long i;
  for (i = 0; i < a[c].size(); i++) {
    if (mark[a[c][i].v] == 0) {
      cdfs(a[c][i].v);
      e_trees[a[c][i].num] =
          2 * dfs_size[a[c][i].v] * (total - dfs_size[a[c][i].v]);
    }
  }
}
void wrap_cdfs(long long p) {
  long long end = 1, q = p, i, sx, sy, temp;
  half_edge ssx, ssy;
  total = 0;
  while (q < n && e[q].wt == e[q + 1].wt) {
    q++;
  }
  for (i = p; i <= q; i++) {
    sx = src(e[i].v1);
    sy = src(e[i].v2);
    ssx.v = sx;
    ssy.v = sy;
    ssx.num = e[i].num;
    ssy.num = e[i].num;
    a[sx].push_back(ssy);
    a[sy].push_back(ssx);
    if (mark[sx] == 0) {
      temp_v[end] = sx;
      end++;
      mark[sx] = 1;
    }
    if (mark[sy] == 0) {
      temp_v[end] = sy;
      end++;
      mark[sy] = 1;
    }
  }
  for (i = 1; i < end; i++) {
    mark[temp_v[i]] = 0;
  }
  for (i = 1; i < end; i++) {
    if (mark[temp_v[i]] == 0) {
      count_total(temp_v[i]);
      total = dfs_size[temp_v[i]];
      cdfs(temp_v[i]);
    }
  }
  for (i = 1; i < end; i++) {
    mark[temp_v[i]] = 0;
    mark2[temp_v[i]] = 0;
    a[temp_v[i]].clear();
    dfs_size[temp_v[i]] = 0;
  }
  for (i = p; i <= q; i++) {
    sx = src(e[i].v1);
    sy = src(e[i].v2);
    ptr[max(sx, sy)] = min(sx, sy);
    comp_size[min(sx, sy)] += comp_size[max(sx, sy)];
    comp_size[max(sx, sy)] = 0;
  }
}
int main() {
  cin >> n;
  long long i;
  for (i = 1; i < n; i++) {
    cin >> e[i].v1 >> e[i].v2 >> e[i].wt;
    e[i].num = i;
    ptr[i] = i;
    comp_size[i] = 1;
    mark[i] = 0;
    mark2[i] = 0;
    dfs_size[i] = 0;
  }
  ptr[n] = n;
  comp_size[n] = 1;
  mark[n] = 0;
  dfs_size[n] = 0;
  sort(e + 1, e + n);
  for (i = 1; i < n; i++) {
    if (i == n || e[i].wt != e[i + 1].wt)
      dsu_add(i);
    else {
      wrap_cdfs(i);
      while (i < n - 1 && e[i].wt == e[i + 1].wt) i++;
    }
  }
  long long maxim = 0, max_num = 0;
  for (i = 1; i < n; i++) {
    if (e_trees[i] > maxim) maxim = e_trees[i];
  }
  cout << maxim;
  for (i = 1; i < n; i++) {
    if (e_trees[i] == maxim) max_num++;
  }
  cout << " " << max_num << endl;
  for (i = 1; i < n; i++) {
    if (e_trees[i] == maxim) cout << i << " ";
  }
  return 0;
}
