#include <bits/stdc++.h>
using namespace std;
int N;
int A[100005], B[100005], C[100005], S[100005];
long long Cnt[100005], Sub[100005], All[100005];
bool V1[100005], V2[100005];
vector<int> Adj[100005];
map<int, vector<int> > Day;
int Find(int Root) { return (S[Root] < 0) ? Root : (S[Root] = Find(S[Root])); }
inline void Union(int x, int y) {
  x = Find(x), y = Find(y);
  if (x == y) return;
  if (S[x] > S[y]) swap(x, y);
  S[x] += S[y];
  S[y] = x;
}
void DFS1(int Cur) {
  V1[Cur] = 0;
  Sub[Cur] = -S[Cur];
  for (int i = 0; i < (int)(Adj[Cur]).size(); ++i)
    if (V1[Adj[Cur][i]]) {
      DFS1(Adj[Cur][i]);
      Sub[Cur] += Sub[Adj[Cur][i]];
    }
}
void DFS2(int Cur, int Val) {
  V2[Cur] = 0;
  All[Cur] = Val;
  for (int i = 0; i < (int)(Adj[Cur]).size(); ++i)
    if (V2[Adj[Cur][i]]) DFS2(Adj[Cur][i], Val);
}
int main() {
  scanf("%d", &N);
  Day.clear();
  for (int i = 1; i < N; ++i) {
    scanf("%d%d%d", A + i, B + i, C + i);
    Day[C[i]].push_back(i);
  }
  memset(S, -1, sizeof(S));
  for (map<int, vector<int> >::iterator it = Day.begin(); it != Day.end();
       ++it) {
    int i;
    for (int j = 0; j < (int)(it->second).size(); ++j) {
      i = it->second[j];
      Adj[Find(A[i])].clear();
      Adj[Find(B[i])].clear();
      V1[Find(A[i])] = V1[Find(B[i])] = 1;
      V2[Find(A[i])] = V2[Find(B[i])] = 1;
    }
    for (int j = 0; j < (int)(it->second).size(); ++j) {
      i = it->second[j];
      Adj[Find(A[i])].push_back(Find(B[i]));
      Adj[Find(B[i])].push_back(Find(A[i]));
    }
    for (int j = 0; j < (int)(it->second).size(); ++j) {
      i = it->second[j];
      if (V1[Find(A[i])]) {
        DFS1(Find(A[i]));
        DFS2(Find(A[i]), Sub[Find(A[i])]);
      }
    }
    for (int j = 0; j < (int)(it->second).size(); ++j) {
      i = it->second[j];
      int u = Find(A[i]), v = Find(B[i]);
      if (Sub[u] < Sub[v]) swap(u, v);
      Cnt[i] = Sub[v] * (All[v] - Sub[v]) * 2LL;
    }
    for (int j = 0; j < (int)(it->second).size(); ++j) {
      i = it->second[j];
      Union(A[i], B[i]);
    }
  }
  long long ans = -1;
  for (int i = 1; i < N; ++i)
    if (Cnt[i] > ans) ans = Cnt[i];
  vector<int> res;
  res.clear();
  for (int i = 1; i < N; ++i)
    if (Cnt[i] == ans) res.push_back(i);
  cout << ans << " " << res.size() << endl;
  for (int i = 0; i < (int)(res).size(); ++i)
    printf("%d%c", res[i], (i + 1 == (int)res.size()) ? '\n' : ' ');
}
