#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
const int lg = 63;
const long long int mod = 1e9 + 7;
const long long int inf = 1e16 + 100;
int pr[N], par[N], a[N], b[N], rnk[N];
long long int ans[N], sz[N], SZ[N];
bool mark[N];
vector<pair<int, int>> adj[N], v;
vector<int> t, vec;
int find_par(int u) {
  if (par[u] == u) return u;
  return par[u] = find_par(par[u]);
}
inline void _union(int x, int y) {
  if (rnk[x] < rnk[y]) swap(x, y);
  par[y] = x;
  SZ[x] += SZ[y];
  if (rnk[x] == rnk[y]) rnk[x]++;
}
void dfs(int u) {
  sz[u] = SZ[u];
  for (auto it : adj[u]) {
    int x = it.first, id = it.second;
    if (x != pr[u]) {
      pr[x] = u;
      dfs(x);
      ans[id] = sz[x];
      sz[u] += sz[x];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    par[i] = pr[i] = i;
    SZ[i] = 1;
  }
  for (int i = 0; i < n - 1; i++) {
    int d;
    cin >> a[i] >> b[i] >> d;
    v.push_back({d, i});
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < n - 1;) {
    vec.clear();
    t.clear();
    int d = v[i].first;
    while (i < n - 1 && v[i].first == d) {
      t.push_back(v[i].second);
      i++;
    }
    for (auto j : t) {
      int x = find_par(a[j]), y = find_par(b[j]);
      adj[x].push_back({y, j});
      adj[y].push_back({x, j});
      if (!mark[x]) vec.push_back(x);
      if (!mark[y]) vec.push_back(y);
      mark[x] = mark[y] = true;
    }
    for (auto x : vec) {
      if (pr[x] == x) dfs(x);
    }
    for (auto j : t) {
      int x = find_par(a[j]), y = find_par(b[j]);
      adj[x].clear();
      adj[y].clear();
      mark[x] = mark[y] = false;
      pr[x] = x;
      pr[y] = y;
      _union(x, y);
    }
    for (auto j : t) {
      int x = find_par(a[j]);
      ans[j] *= (SZ[x] - ans[j]);
    }
  }
  long long int mx = 0;
  for (int i = 0; i < n - 1; i++) {
    ans[i] *= 2;
    mx = max(mx, ans[i]);
  }
  int cnt = 0;
  for (int i = 0; i < n - 1; i++) cnt += (ans[i] == mx);
  cout << mx << ' ' << cnt << endl;
  for (int i = 0; i < n - 1; i++) {
    if (ans[i] == mx) cout << i + 1 << ' ';
  }
  cout << endl;
  return 0;
}
