#include <bits/stdc++.h>
using namespace std;
const int N = 1000 * 100 + 10;
int n, a[N], b[N], d[N];
long long ans[N];
vector<int> vec[N];
struct DSU {
  vector<int> sz, par;
  stack<pair<int, int>> s, t;
  DSU(int n = 0) {
    sz.resize(n + 1, 1), par.resize(n + 1);
    iota(par.begin(), par.end(), 0);
  }
  int get_par(int v) {
    while (par[v] != v) v = par[v];
    return v;
  }
  void Union(int v, int u) {
    v = get_par(v), u = get_par(u);
    if (sz[u] > sz[v]) swap(u, v);
    s.push({u, par[u]}), t.push({v, sz[v]});
    par[u] = v, sz[v] += sz[u];
  }
  void Undo() {
    pair<int, int> x = s.top(), y = t.top();
    s.pop(), t.pop();
    par[x.first] = x.second;
    sz[y.first] = y.second;
  }
  int size(int v) { return sz[get_par(v)]; }
} G;
void solve(int c, int l, int r) {
  if (l >= r) return;
  if (l + 1 == r) {
    int i = vec[c][l], v = a[i], u = b[i];
    ans[i] = 1LL * G.size(v) * G.size(u);
    return;
  }
  int mid = l + r >> 1;
  for (int i = l; i < mid; i++) {
    int v = a[vec[c][i]], u = b[vec[c][i]];
    G.Union(v, u);
  }
  solve(c, mid, r);
  for (int i = l; i < mid; i++) G.Undo();
  for (int i = mid; i < r; i++) {
    int v = a[vec[c][i]], u = b[vec[c][i]];
    G.Union(v, u);
  }
  solve(c, l, mid);
  for (int i = mid; i < r; i++) G.Undo();
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  G = DSU(n);
  vector<int> all;
  for (int i = 1; i < n; i++) {
    cin >> a[i] >> b[i] >> d[i];
    all.push_back(d[i]);
  }
  sort(all.begin(), all.end());
  all.resize(unique(all.begin(), all.end()) - all.begin());
  for (int i = 1; i < n; i++) {
    d[i] = lower_bound(all.begin(), all.end(), d[i]) - all.begin();
    vec[d[i]].push_back(i);
  }
  for (int i = 0; i < N; i++) {
    solve(i, 0, (int)(vec[i].size()));
    for (auto e : vec[i]) G.Union(a[e], b[e]);
  }
  long long mx = 0;
  for (int i = 1; i < n; i++) mx = max(ans[i], mx);
  vector<int> o;
  for (int i = 1; i < n; i++)
    if (ans[i] == mx) o.push_back(i);
  cout << mx * 2 << ' ' << (int)(o.size()) << '\n';
  for (auto x : o) cout << x << '\n';
  cout << '\n';
  return 0;
}
