#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> a[100020];
vector<int> p;
map<int, vector<pair<pair<int, int>, int>>> b;
long long z[100020];
int f[100020], c[100020];
int n;
int F(int x) { return f[x] != x ? f[x] = F(f[x]) : x; }
void U(int x, int y) {
  c[F(x)] += c[F(y)];
  f[F(y)] = F(x);
}
int dfs(int x, int y, int w) {
  p.push_back(w);
  z[w] = c[x];
  for (auto i : a[x])
    if (i.first != y) z[w] += dfs(i.first, x, i.second);
  a[x].clear();
  return z[w];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) c[f[i] = i] = 1;
  for (int i = 1; i < n; i++) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    b[z].push_back(make_pair(pair<int, int>(x, y), i));
  }
  for (auto& c : b) {
    set<int> s;
    for (auto& i : c.second) {
      int x = F(i.first.first), y = F(i.first.second);
      s.insert(x);
      a[x].push_back(pair<int, int>(y, i.second));
      a[y].push_back(pair<int, int>(x, i.second));
    }
    for (auto i : s)
      if (a[i].size()) {
        long long u = dfs(i, 0, 0);
        for (auto j : p) z[j] *= (u - z[j]) * 2;
        p.clear();
      }
    for (auto& i : c.second) U(i.first.first, i.first.second);
  }
  long long u = *max_element(z + 1, z + n);
  printf("%I64d %d\n", u, count(z + 1, z + n, u));
  for (int i = 1; i < n; i++)
    if (z[i] == u) printf("%d ", i);
}
