#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n;
int cnt;
int p[N];
int sz[N];
int num[N];
int sz1[N];
int idx[N];
int comp[N];
int used[N];
long long res[N];
vector<int> g[N];
int a[N], b[N], d[N];
int get(int x) { return (p[x] == x ? x : p[x] = get(p[x])); }
void dfs(int v) {
  used[v] = 1;
  num[v] = cnt;
  sz1[v] = sz[v];
  comp[cnt] += sz[v];
  for (auto to : g[v]) {
    if (used[to] == 1) continue;
    dfs(to);
    sz1[v] += sz1[to];
  }
}
void merge(int x, int y) {
  if (x == y) return;
  if (sz[x] < sz[y]) swap(x, y);
  p[y] = x;
  sz[x] += sz[y];
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a[i] >> b[i] >> d[i];
    p[i] = i, sz[i] = 1, idx[i] = i;
  }
  sz[n] = 1, p[n] = n;
  sort(idx + 1, idx + n, [&](int x, int y) { return (d[x] < d[y]); });
  for (int i = 1; i < n; i++) {
    int j = i;
    while (j < n && d[idx[i]] == d[idx[j]]) j++;
    for (int k = i; k < j; k++) {
      int x = get(a[idx[k]]);
      int y = get(b[idx[k]]);
      g[x].push_back(y);
      g[y].push_back(x);
    }
    for (int k = i; k < j; k++) {
      int x = get(a[idx[k]]);
      if (used[x] == 0) {
        cnt++;
        dfs(x);
      }
    }
    for (int k = i; k < j; k++) {
      int x = get(a[idx[k]]);
      int y = get(b[idx[k]]);
      if (sz1[x] > sz1[y]) swap(x, y);
      int c = comp[num[x]] - sz1[x];
      res[idx[k]] += c * 1ll * sz1[x] * 2ll;
    }
    for (int k = i; k < j; k++) {
      int x = get(a[idx[k]]);
      int y = get(b[idx[k]]);
      merge(x, y);
      g[x].clear();
      g[y].clear();
      used[x] = used[y] = 0;
    }
    i = j - 1;
  }
  long long mx = 0;
  for (int i = 1; i < n; i++) {
    mx = max(mx, res[i]);
  }
  vector<int> ans;
  for (int i = 1; i < n; i++) {
    if (res[i] == mx) ans.push_back(i);
  }
  cout << mx << " " << (int)ans.size() << "\n";
  for (auto x : ans) cout << x << " ";
  cout << "\n";
}
