#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1000 * 100 + 10;
long long par[maxn], t[maxn];
long long get_par(long long v) {
  return par[v] == v ? v : par[v] = get_par(par[v]);
}
void merge(long long fi, long long se) {
  t[fi] += t[se], t[se] = 0, par[se] = fi;
}
vector<pair<long long, long long> > e[maxn];
long long s[maxn], val[maxn];
map<long long, long long> mp;
long long dp[maxn];
bool mark[maxn];
void Clean(long long cnt) {
  mp.clear();
  for (long long i = 0; i < cnt; i++)
    e[i].clear(), mark[i] = 0, val[i] = 0, s[i] = 0;
}
void dfs(long long source) {
  s[source] = t[val[source]];
  mark[source] = true;
  for (long long i = 0; i < e[source].size(); i++)
    if (!mark[e[source][i].first])
      dfs(e[source][i].first), s[source] += s[e[source][i].first];
}
void DFS(long long source, long long par, long long sum) {
  for (long long i = 0; i < e[source].size(); i++)
    if (e[source][i].first != par)
      DFS(e[source][i].first, source, sum),
          dp[e[source][i].second] =
              2 * (sum - s[e[source][i].first]) * s[e[source][i].first];
}
int main() {
  long long n, fi, se, id;
  long long w;
  vector<pair<pair<long long, long long>, pair<long long, long long> > > q(0);
  cin >> n;
  for (long long i = 0; i < n - 1; i++)
    cin >> fi >> se >> w,
        q.push_back(make_pair(make_pair(w, i), make_pair(fi, se)));
  sort(q.begin(), q.end());
  reverse(q.begin(), q.end());
  for (long long i = 1; i <= n; i++) par[i] = i, t[i] = 1;
  vector<pair<long long, pair<long long, long long> > > help(0);
  while (!q.empty()) {
    w = q.back().first.first;
    while (!q.empty() && q.back().first.first == w)
      fi = get_par(q.back().second.first), se = get_par(q.back().second.second),
      id = q.back().first.second, q.pop_back(),
      help.push_back(make_pair(id, make_pair(fi, se)));
    long long cnt = 0;
    for (long long i = 0; i < help.size(); i++) {
      if (mp.find(help[i].second.first) == mp.end())
        mp[help[i].second.first] = cnt, val[cnt] = help[i].second.first, cnt++;
      if (mp.find(help[i].second.second) == mp.end())
        mp[help[i].second.second] = cnt, val[cnt] = help[i].second.second,
        cnt++;
      fi = mp[help[i].second.first];
      se = mp[help[i].second.second];
      e[fi].push_back(make_pair(se, help[i].first));
      e[se].push_back(make_pair(fi, help[i].first));
    }
    for (long long i = 0; i < cnt; i++)
      if (!mark[i]) dfs(i), DFS(i, -1, s[i]);
    Clean(cnt);
    for (long long i = 0; i < help.size(); i++)
      help[i].second.first = get_par(help[i].second.first),
      help[i].second.second = get_par(help[i].second.second),
      merge(help[i].second.first, help[i].second.second);
    help.clear();
  }
  vector<pair<long long, long long> > E(0);
  for (long long i = 0; i < n - 1; i++) E.push_back(make_pair(dp[i], i + 1));
  sort(E.begin(), E.end());
  long long beauty = E.back().first;
  vector<long long> res(0);
  while (!E.empty() && E.back().first == beauty)
    res.push_back(E.back().second), E.pop_back();
  sort(res.begin(), res.end());
  cout << beauty << " " << res.size() << endl;
  for (long long i = 0; i < res.size(); i++) cout << res[i] << " ";
  cout << endl;
  return 0;
}
