#include <bits/stdc++.h>
using namespace std;
struct edge {
  int x, y, w, id, next;
};
const int maxn = 100100;
int n, num;
typedef int node[maxn];
node head, ansq, f, fa, s, vis, q, root;
edge e[maxn], ee[maxn << 1];
bool cmp(const edge &a, const edge &b) { return a.w < b.w; }
int find(int k) {
  if (fa[k] < 0)
    return k;
  else {
    fa[k] = find(fa[k]);
    return fa[k];
  }
}
inline void add(int a, int b) {
  num++;
  ee[num].next = head[a];
  head[a] = num;
  ee[num].y = b;
}
void dfs(int k, int r) {
  root[k] = r;
  for (int temp = head[k]; temp >= 0; temp = ee[temp].next) {
    int j = ee[temp].y;
    if (j != f[k]) {
      f[j] = k;
      dfs(j, r);
      s[k] += s[j];
    }
  }
}
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].w);
    e[i].id = i + 1;
  }
  sort(e, e + n - 1, cmp);
  memset(vis, -1, sizeof(vis));
  memset(f, -1, sizeof(f));
  memset(fa, -1, sizeof(fa));
  for (int i = 1; i <= n; i++) s[i] = 1;
  long long ans = -1;
  int tot = 0;
  for (int i = 0; i < n - 1;) {
    for (int j = i; j < n - 1 && e[j].w == e[i].w; j++)
      head[find(e[j].x)] = head[find(e[j].y)] = -1;
    num = -1;
    int top = 0;
    for (int j = i; j < n - 1 && e[j].w == e[i].w; j++) {
      int a = find(e[j].x), b = find(e[j].y);
      add(a, b);
      add(b, a);
      if (vis[a] != i) {
        vis[a] = i;
        q[top++] = a;
      }
      if (vis[b] != i) {
        vis[b] = i;
        q[top++] = b;
      }
    }
    for (int j = 0; j < top; j++)
      if (f[q[j]] < 0) dfs(q[j], q[j]);
    for (int j = i; j < n - 1 && e[j].w == e[i].w; j++) {
      int a = find(e[j].x), b = find(e[j].y);
      if (f[a] == b) swap(a, b);
      if ((long long)(s[root[a]] - s[b]) * s[b] > ans) {
        ans = (long long)(s[root[a]] - s[b]) * s[b];
        tot = 0;
        ansq[tot++] = e[j].id;
      } else if ((long long)(s[root[a]] - s[b]) * s[b] == ans)
        ansq[tot++] = e[j].id;
    }
    int last;
    for (int j = i; j < n - 1 && e[j].w == e[i].w; j++) {
      int a = find(e[j].x), b = find(e[j].y);
      if (fa[a] < 0 && a != root[a]) fa[a] = root[a];
      if (fa[b] < 0 && b != root[b]) fa[b] = root[b];
      last = j;
    }
    i = last + 1;
  }
  sort(ansq, ansq + tot);
  printf("%I64d %d\n", ans << 1LL, tot);
  for (int i = 0; i < tot - 1; i++) printf("%d ", ansq[i]);
  printf("%d\n", ansq[tot - 1]);
  return 0;
}
