#include <bits/stdc++.h>
using namespace std;
void smain();
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(12);
  cout << fixed;
  smain();
  return 0;
}
long long n;
long long p[500000], sz[500000], ans[500000];
long long get_p(long long v) { return v == p[v] ? v : p[v] = get_p(p[v]); }
vector<pair<long long, long long> > g[500000];
long long used[500000], cc = 1;
long long compsz = 0;
long long dfs(long long v, long long par = -1) {
  long long ret = sz[v];
  used[v] = cc;
  for (auto j : g[v])
    if (j.first != par) {
      long long t = dfs(j.first, v);
      ans[j.second] = t * (compsz - t) * 2;
      ret += t;
    }
  return ret;
}
void smain() {
  for (; cin >> n;) {
    map<long long,
        vector<pair<pair<long long, long long>, pair<long long, long long> > > >
        edges;
    for (long long i = 0; i < n - 1; i++) {
      pair<pair<long long, long long>, pair<long long, long long> > cur;
      cin >> cur.second.first >> cur.second.second >> cur.first.first,
          cur.first.second = i;
      edges[cur.first.first].push_back(cur);
    }
    for (long long i = 0; i < n + 1; i++) p[i] = i, sz[i] = 1;
    for (auto it : edges) {
      set<long long> verts;
      for (auto i : it.second) {
        long long a = get_p(i.second.first), b = get_p(i.second.second);
        verts.insert(a);
        verts.insert(b);
      }
      for (auto i : verts) g[i].clear();
      for (auto i : it.second) {
        long long a = get_p(i.second.first), b = get_p(i.second.second);
        g[a].emplace_back(b, i.first.second);
        g[b].emplace_back(a, i.first.second);
      }
      cc += 1;
      for (auto i : verts)
        if (used[i] != cc) {
          compsz = dfs(i, -1);
          dfs(i, -1);
        }
      for (auto i : it.second) {
        long long a = get_p(i.second.first), b = get_p(i.second.second);
        p[b] = a;
        sz[a] += sz[b];
      }
    }
    long long mx = *max_element(ans, ans + n - 1);
    vector<long long> res;
    for (long long i = 0; i < n - 1; i++)
      if (ans[i] == mx) res.push_back(i + 1);
    cout << mx << ' ' << res.size() << '\n';
    for (auto it : res) cout << it << ' ';
    cout << endl;
  }
}
