#include <bits/stdc++.h>
using namespace std;
const int H = 100 * 1000 + 10;
int ertefa[H];
int tedad[H];
int par[H];
int n, glob;
int mark[H], mark2[H];
int sum = 0;
struct man {
  int x, y, w, ind;
  long long out;
  bool operator<(const man &temp) const {
    if (w == temp.w) {
      if (out == temp.out) {
        return ind < temp.ind;
      }
      return out > temp.out;
    }
    return w < temp.w;
  }
};
man a[H];
vector<int> b[H][2];
int findpar(int x) {
  if (par[x] == x) {
    return x;
  }
  par[x] = findpar(par[x]);
  return par[x];
}
void merge(int x, int y) {
  int xx = findpar(x);
  int yy = findpar(y);
  if (ertefa[xx] > ertefa[yy]) {
    par[yy] = xx;
    tedad[xx] += tedad[yy];
  } else if (ertefa[xx] < ertefa[yy]) {
    par[xx] = yy;
    tedad[yy] += tedad[xx];
  } else {
    par[xx] = y;
    tedad[yy] += tedad[xx];
    ertefa[yy]++;
  }
}
void dfs(int x) {
  mark[x] = glob;
  sum += tedad[x];
  for (int i = 0; i < (int)b[x][0].size(); i++) {
    if (mark[b[x][0][i]] != glob) {
      dfs(b[x][0][i]);
    }
  }
}
int dfs2(int x) {
  int ret = tedad[x];
  int temp;
  mark2[x] = glob;
  for (int i = 0; i < (int)b[x][0].size(); i++) {
    if (mark2[b[x][0][i]] != glob) {
      temp = dfs2(b[x][0][i]);
      a[b[x][1][i]].out = ((long long)(temp)) * (sum - temp);
      ret += temp;
    }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].w);
    a[i].ind = i;
  }
  for (int i = 0; i <= n; i++) {
    par[i] = i;
    tedad[i] = 1;
    ertefa[i] = 1;
  }
  sort(a, a + n - 1);
  memset(mark, -1, sizeof mark);
  memset(mark2, -1, sizeof mark2);
  for (int i = 0; i < n - 1;) {
    glob = i;
    int p = i;
    int x, y;
    while (p < n - 1 && a[p].w == a[i].w) {
      x = findpar(a[p].x);
      y = findpar(a[p].y);
      b[x][0].push_back(y);
      b[y][0].push_back(x);
      b[x][1].push_back(p);
      b[y][1].push_back(p);
      p++;
    }
    p = i;
    while (p < n - 1 && a[p].w == a[i].w) {
      x = findpar(a[p].x);
      y = findpar(a[p].y);
      if (mark[x] != glob) {
        sum = 0;
        dfs(x);
        dfs2(x);
      }
      b[x][0].clear();
      b[x][1].clear();
      b[y][0].clear();
      b[y][1].clear();
      p++;
    }
    p = i;
    while (p < n - 1 && a[p].w == a[i].w) {
      merge(a[p].x, a[p].y);
      p++;
    }
    i = p;
  }
  for (int i = 0; i < n - 1; i++) {
    a[i].w = 0;
  }
  sort(a, a + n);
  int p = 0;
  cout << a[0].out * 2 << " ";
  while (a[p].out == a[0].out && p < n - 1) {
    p++;
  }
  cout << p << endl;
  for (int i = 0; i < p; i++) {
    cout << a[i].ind + 1 << " ";
  }
  cout << endl;
  return 0;
}
