#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:33554432")
using namespace std;
int P[1 << 18];
int B[1 << 18];
int C[1 << 18];
int S[1 << 18];
long long R[1 << 18];
vector<pair<int, int> > E[1 << 18];
int gMark, gS;
int Parent(int a) {
  if (P[a] == a) return a;
  return P[a] = Parent(P[a]);
}
void dfs(int a, int p) {
  B[a] = gMark;
  int i;
  for (i = 0; i < int((E[a]).size()); i++) {
    int b = E[a][i].first;
    if (b == p) continue;
    dfs(b, a);
    S[a] += S[b];
  }
  S[a] += C[a];
}
void dfs2(int a, int p) {
  B[a] = gMark;
  int i;
  for (i = 0; i < int((E[a]).size()); i++) {
    int b = E[a][i].first;
    if (b == p) continue;
    dfs2(b, a);
    long long s = S[b];
    R[E[a][i].second] = s * (gS - s);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int i, j;
  vector<pair<pair<int, int>, pair<int, int> > > v;
  for (i = 0; i < n - 1; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    v.push_back(make_pair(pair<int, int>(c, i), pair<int, int>(a - 1, b - 1)));
  }
  sort((v).begin(), (v).end());
  for (i = 0; i < n + n; i++) {
    P[i] = i;
    C[i] = 1;
    S[i] = 0;
  }
  memset(B, 0, sizeof(B));
  gMark = 0;
  int prev = 0;
  int cnt = n;
  for (i = 1; i < n; i++)
    if (i == n - 1 || v[i].first.first != v[i - 1].first.first) {
      for (j = prev; j < i; j++) {
        int a = Parent(v[j].second.first);
        int b = Parent(v[j].second.second);
        E[a].push_back(pair<int, int>(b, v[j].first.second));
        E[b].push_back(pair<int, int>(a, v[j].first.second));
      }
      ++gMark;
      for (j = prev; j < i; j++) {
        int a = Parent(v[j].second.first);
        if (B[a] != gMark) dfs(a, -1);
      }
      ++gMark;
      for (j = prev; j < i; j++) {
        int a = Parent(v[j].second.first);
        if (B[a] != gMark) {
          gS = S[a];
          dfs2(a, -1);
        }
      }
      for (j = prev; j < i; j++) {
        int a = Parent(v[j].second.first);
        int b = Parent(v[j].second.second);
        P[a] = P[b] = cnt;
        C[cnt] = C[a] + C[b];
        ++cnt;
      }
      prev = i;
    }
  long long res = 0;
  for (i = 0; i < n - 1; i++) res = max(res, R[i]);
  vector<int> ret;
  for (i = 0; i < n - 1; i++)
    if (R[i] == res) ret.push_back(i + 1);
  printf("%lld %d\n", res + res, int((ret).size()));
  for (i = 0; i < int((ret).size()); i++)
    printf("%d%c", ret[i], i == int((ret).size()) - 1 ? '\n' : ' ');
  return 0;
};
