#include <bits/stdc++.h>
using namespace std;
struct edge {
  int x, y, d, i;
  bool operator<(const edge &t) const { return d < t.d; }
} e[100005];
int n, f[100005], s[100005], h[100005], t[200005][3], w, q[100005], wq,
    v[100005], mai;
long long out[100005], ma;
bool flag;
int Q[100005], wQ;
int find(int z) {
  wQ = 0;
  Q[wQ++] = z;
  while (f[Q[wQ - 1]] != Q[wQ - 1]) {
    Q[wQ] = f[Q[wQ - 1]];
    wQ++;
  }
  for (int i = 0; i < wQ; i++) {
    f[Q[i]] = Q[wQ - 1];
  }
  return Q[wQ - 1];
}
void adde(int x, int y, int z) {
  t[w][0] = y;
  t[w][1] = z;
  t[w][2] = h[x];
  h[x] = w++;
}
int sum(int z, int pre) {
  int ret = s[z];
  for (int i = h[z]; i != -1; i = t[i][2]) {
    if (t[i][0] != pre) {
      ret += sum(t[i][0], z);
    }
  }
  return ret;
}
int dfs(int z, int pre, int sum) {
  v[z] = -1;
  int ret = s[z];
  for (int i = h[z]; i != -1; i = t[i][2]) {
    if (t[i][0] != pre) {
      int temp = dfs(t[i][0], z, sum);
      out[t[i][1]] = 2 * (long long)temp * (long long)(sum - temp);
      ret += temp;
    }
  }
  h[z] = -1;
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d%d", &e[i].x, &e[i].y, &e[i].d);
    e[i].i = i;
  }
  sort(e, e + n - 1);
  for (int i = 1; i <= n; i++) {
    f[i] = i;
    s[i] = 1;
  }
  memset(v, -1, sizeof(v));
  memset(h, -1, sizeof(h));
  w = wq = 0;
  for (int i = 0, I = 0; i < n - 1; i++) {
    e[i].x = find(e[i].x);
    e[i].y = find(e[i].y);
    if (e[i].x != e[i].y) {
      adde(e[i].x, e[i].y, e[i].i);
      adde(e[i].y, e[i].x, e[i].i);
      if (v[e[i].x] == -1) {
        v[e[i].x] = e[i].d;
        q[wq++] = e[i].x;
      }
      if (v[e[i].y] == -1) {
        v[e[i].y] = e[i].d;
        q[wq++] = e[i].y;
      }
    }
    if (((i == n - 2) || (e[i].d != e[i + 1].d)) && (wq)) {
      for (int j = 0; j < wq; j++) {
        if (v[q[j]] == e[i].d) {
          int temp = sum(q[j], q[j]);
          dfs(q[j], q[j], temp);
        }
      }
      for (int j = I; j <= i; j++) {
        e[j].x = find(e[j].x);
        e[j].y = find(e[j].y);
        if (e[j].x != e[j].y) {
          s[e[j].y] += s[e[j].x];
          f[e[j].x] = e[j].y;
        }
      }
      I = i;
      w = wq = 0;
    }
  }
  ma = -1;
  for (int i = 0; i < n - 1; i++) {
    if (out[i] > ma) {
      ma = out[i];
      mai = 1;
    } else if (out[i] == ma)
      mai++;
  }
  cout << ma << " " << mai << endl;
  flag = false;
  for (int i = 0; i < n - 1; i++) {
    if (out[i] == ma) {
      if (flag) printf(" ");
      flag = true;
      printf("%d", i + 1);
    }
  }
  printf("\n");
  return 0;
}
