#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
const int maxn = 100100;
int a[maxn][4], b[maxn][4];
int ind[maxn];
int depth[maxn];
int parent[maxn];
vector<int> g[maxn];
int comp[maxn];
int csize[maxn];
long long below[maxn], above[maxn];
long long res[maxn];
int getcomp(int x) { return comp[x] == x ? x : comp[x] = getcomp(comp[x]); }
void merge(int x, int y) {
  x = getcomp(x);
  y = getcomp(y);
  if (x == y) return;
  int cs = csize[x] + csize[y];
  if (rand() & 1) {
    comp[x] = y;
  } else {
    comp[y] = x;
  }
  x = getcomp(x);
  y = getcomp(y);
  csize[x] = cs;
}
struct cmp {
  bool operator()(int x, int y) const {
    if (a[x][2] != a[y][2]) return a[x][2] < a[y][2];
    int mx = max(depth[a[x][0]], depth[a[x][1]]);
    int my = max(depth[a[y][0]], depth[a[y][1]]);
    if (mx != my) return mx > my;
    if (a[x][0] != a[y][0]) return a[x][0] < a[y][0];
    return a[x][1] < a[y][1];
  }
};
void go(int v, int par = -1) {
  for (int i = 0; i < g[v].size(); i++) {
    int p = g[v][i];
    if (p == par) continue;
    depth[p] = depth[v] + 1;
    parent[p] = v;
    go(p, v);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    x--;
    y--;
    a[i][0] = x;
    a[i][1] = y;
    a[i][2] = z;
    a[i][3] = i;
    ind[i] = i;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 0; i < n; i++) {
    comp[i] = i;
    csize[i] = 1;
  }
  parent[0] = -1;
  go(0);
  for (int i = 0; i < n - 1; i++) {
    if (depth[a[i][0]] < depth[a[i][1]]) swap(a[i][0], a[i][1]);
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < 4; j++) {
      b[i][j] = a[i][j];
    }
  }
  sort(ind, ind + n - 1, cmp());
  for (int i = 0; i < n - 1; i++) {
    for (int t = 0; t < 4; t++) {
      a[i][t] = b[ind[i]][t];
    }
  }
  int fr = 0;
  for (; fr < n - 1;) {
    int st = fr;
    for (; fr < n - 1 && a[fr][2] == a[st][2]; fr++) {
      int x = a[fr][0];
      int y = a[fr][1];
      below[fr] = csize[getcomp(x)];
      merge(x, y);
    }
    for (int i = st; i < fr; i++) {
      int x = a[i][0];
      int y = a[i][1];
      int all = csize[getcomp(y)];
      above[i] = all - below[i];
    }
  }
  for (int i = 0; i < n - 1; i++) {
    res[a[i][3]] = below[i] * above[i];
  }
  long long mx = -1;
  for (int i = 0; i < n - 1; i++) {
    if (res[i] > mx) {
      mx = res[i];
    }
  }
  vector<int> out;
  for (int i = 0; i < n - 1; i++) {
    if (res[i] == mx) {
      out.push_back(i);
    }
  }
  mx *= 2;
  cout << mx;
  printf(" %d\n", out.size());
  for (int i = 0; i < out.size(); i++) {
    if (i) printf(" ");
    printf("%d", out[i] + 1);
  }
  puts("");
  return 0;
}
