#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 1e5 + 5;
long long n, val;
pair<pair<long long, long long>, pair<long long, long long> > edge[MAX_N];
long long par[MAX_N];
long long len[MAX_N];
vector<long long> h;
vector<long long> ans;
vector<pair<long long, long long> > G[MAX_N];
vector<long long> rot, ver;
long long P[MAX_N];
long long down[MAX_N];
long long up[MAX_N];
bool mark[MAX_N];
long long root(long long v) {
  return (par[v] == v ? v : par[v] = root(par[v]));
}
void cheak(long long tmp, long long id) {
  if (val < tmp) {
    val = tmp;
    ans.clear();
  }
  if (val == tmp) ans.push_back(id);
}
long long dfs1(long long v, long long p) {
  P[v] = p;
  down[v] = len[v];
  mark[v] = true;
  for (pair<long long, long long> u : G[v])
    if (!mark[u.first]) down[v] += dfs1(u.first, v);
  return down[v];
}
void dfs2(long long v, long long uval) {
  up[v] = uval;
  for (pair<long long, long long> u : G[v])
    if (u.first != P[v]) dfs2(u.first, uval + down[v] - down[u.first]);
}
void dfs3(long long v) {
  for (pair<long long, long long> u : G[v])
    if (u.first != P[v]) {
      dfs3(u.first);
      cheak(up[u.first] * down[u.first], u.second);
    }
}
void calc() {
  for (long long id : h) {
    ver.push_back(root(edge[id].second.first));
    ver.push_back(root(edge[id].second.second));
  }
  sort(ver.begin(), ver.end());
  ver.resize(unique(ver.begin(), ver.end()) - ver.begin());
  for (long long id : h) {
    G[root(edge[id].second.first)].push_back(
        {root(edge[id].second.second), edge[id].first.second});
    G[root(edge[id].second.second)].push_back(
        {root(edge[id].second.first), edge[id].first.second});
  }
  for (long long v : ver)
    if (!mark[v]) {
      rot.push_back(v);
      dfs1(v, v);
    }
  for (long long v : rot) dfs2(v, 0);
  for (long long v : rot) dfs3(v);
  rot.clear();
  for (long long v : ver) {
    G[v].clear();
    mark[v] = false;
  }
  ver.clear();
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long v, u, d;
    cin >> edge[i].second.first >> edge[i].second.second >> edge[i].first.first;
    edge[i].first.second = i + 1;
    edge[i].second.first--, edge[i].second.second--;
  }
  sort(edge, edge + n - 1);
  for (long long i = 0; i < n; i++) {
    par[i] = i;
    len[i] = 1;
  }
  h.push_back(0);
  for (long long i = 1; i < n - 1; i++) {
    if (edge[i].first.first != edge[i - 1].first.first) {
      calc();
      for (long long id : h) {
        len[root(edge[id].second.second)] += len[root(edge[id].second.first)];
        par[root(edge[id].second.first)] = root(edge[id].second.second);
      }
      h.clear();
    }
    h.push_back(i);
  }
  calc();
  cout << 2 * val << " " << ans.size() << "\n";
  sort(ans.begin(), ans.end());
  for (long long u : ans) cout << u << " ";
  return 0;
}
