#include <bits/stdc++.h>
using namespace std;
int father[100005], mark[100005];
int head[100005], tot, Cnt[100005];
int sum[100005];
struct Edge {
  int to, index, next;
} edge[100005 * 10];
struct node {
  int x, y, v, index;
  long long tree;
} s[100005];
long long Ans[100005];
bool cmp(node a, node b) { return (a.v < b.v); }
bool cmp2(node a, node b) { return (a.index < b.index); }
int getfa(int v) {
  if (father[v] != v) father[v] = getfa(father[v]);
  return father[v];
}
void add(int a, int b, int c) {
  edge[tot].to = b, edge[tot].index = c;
  edge[tot].next = head[a], head[a] = tot++;
}
void DFS(int x, int pre) {
  sum[x] = Cnt[x];
  for (int i = head[x]; i != -1; i = edge[i].next) {
    int y = edge[i].to;
    if (y != pre) {
      DFS(y, x);
      sum[x] += sum[y];
    }
  }
}
void Calc(int x, int pre, int All) {
  for (int i = head[x]; i != -1; i = edge[i].next) {
    int y = edge[i].to;
    if (y != pre) {
      Ans[edge[i].index] = (long long)sum[y] * (All - sum[y]) * 2;
      Calc(y, x, All);
    }
  }
}
void solve(int be, int en) {
  int i, j;
  tot = 0;
  for (i = be; i <= en; i++) {
    int x = getfa(s[i].x);
    int y = getfa(s[i].y);
    head[x] = -1;
    head[y] = -1;
    sum[x] = 0;
    sum[y] = 0;
  }
  for (i = be; i <= en; i++) {
    int x = getfa(s[i].x);
    int y = getfa(s[i].y);
    add(x, y, s[i].index);
    add(y, x, s[i].index);
  }
  for (i = be; i <= en; i++) {
    int x = getfa(s[i].x);
    if (sum[x] == 0) {
      DFS(x, -1);
      Calc(x, -1, sum[x]);
    }
  }
  for (i = be; i <= en; i++) {
    int x = getfa(s[i].x);
    int y = getfa(s[i].y);
    if (x == y) continue;
    father[x] = y;
    Cnt[y] += Cnt[x];
  }
}
int main() {
  int n, i, j;
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i <= n; i++) {
      father[i] = i;
      Cnt[i] = 1;
    }
    for (i = 1; i < n; i++) {
      scanf("%d %d %d", &s[i].x, &s[i].y, &s[i].v);
      s[i].index = i;
    }
    sort(s + 1, s + n, cmp);
    for (i = 1; i < n;) {
      for (j = i + 1; j < n; j++)
        if (s[j].v != s[i].v) break;
      solve(i, j - 1);
      i = j;
    }
    long long ans = -1;
    int cnt = 0;
    for (i = 1; i < n; i++) {
      if (Ans[i] > ans)
        ans = Ans[i], cnt = 1;
      else if (Ans[i] == ans)
        cnt++;
    }
    cout << ans << " " << cnt << endl;
    for (i = 1; i < n; i++)
      if (Ans[i] == ans) printf("%d ", i);
    puts("");
  }
  return 0;
}
