#include <bits/stdc++.h>
using namespace std;
const long long MAX1 = 2e5 + 7, MOD = 1e9 + 7;
long long n, x, y, par[MAX1], sz[MAX1], z, flag, root, mark[MAX1], cnt, p[MAX1],
    ted[MAX1];
vector<pair<long long, long long> > adj[MAX1];
vector<long long> ans;
vector<pair<pair<long long, long long>, long long> > vec;
pair<pair<long long, long long>, pair<long long, long long> > num[MAX1];
set<long long> st, se;
long long parent(long long u) {
  if (par[u] == u) return u;
  return par[u] = parent(par[u]);
}
void merge(long long u, long long v) {
  x = parent(u);
  y = parent(v);
  if (x == y) return;
  if (sz[y] < sz[x]) swap(x, y);
  par[x] = y;
  sz[y] += sz[x];
  sz[x] = 0;
}
void DFS(long long u) {
  se.insert(u);
  st.erase(u);
  mark[u] = 0;
  for (int i = 0; i < adj[u].size(); ++i) {
    if (mark[adj[u][i].first]) {
      DFS(adj[u][i].first);
      ted[adj[u][i].second] += p[adj[u][i].first] * (cnt - p[adj[u][i].first]);
      p[u] += p[adj[u][i].first];
    }
  }
  p[u] += sz[u];
}
void DFS1(long long u) {
  mark[u] = 1;
  cnt += sz[u];
  for (int i = 0; i < adj[u].size(); ++i) {
    if (mark[adj[u][i].first] == 2) {
      DFS1(adj[u][i].first);
    }
  }
}
void solve() {
  cnt = 0;
  st.clear();
  for (int i = 0; i < vec.size(); ++i) {
    vec[i].first.first = parent(vec[i].first.first);
    vec[i].first.second = parent(vec[i].first.second);
    st.insert(vec[i].first.first);
    st.insert(vec[i].first.second);
    if (!mark[vec[i].first.first])
      cnt += sz[vec[i].first.first], mark[vec[i].first.first] = 2;
    if (!mark[vec[i].first.second])
      cnt += sz[vec[i].first.second], mark[vec[i].first.second] = 2;
    adj[vec[i].first.first].push_back({vec[i].first.second, vec[i].second});
    adj[vec[i].first.second].push_back({vec[i].first.first, vec[i].second});
  }
  while (st.size()) {
    se.clear();
    long long adad = *(st.begin());
    cnt = 0;
    DFS1(adad);
    DFS(adad);
    for (auto i : se) merge(adad, i);
  }
  for (int i = 0; i < vec.size(); ++i) {
    p[vec[i].first.first] = 0;
    p[vec[i].first.second] = 0;
    adj[vec[i].first.first].clear();
    adj[vec[i].first.second].clear();
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= n; ++i) sz[i] = 1, par[i] = i;
  for (int i = 0; i < n - 1; ++i) {
    cin >> num[i].second.first >> num[i].second.second >> num[i].first.first;
    num[i].first.second = i + 1;
  }
  sort(num, num + n - 1);
  for (int i = 0; i < n - 1;) {
    vec.clear();
    flag = num[i].first.first;
    while (i < n - 1 && num[i].first.first == flag) {
      vec.push_back(
          {{num[i].second.first, num[i].second.second}, num[i].first.second});
      ++i;
    }
    solve();
  }
  cnt = 0;
  for (int i = 1; i <= n - 1; ++i) cnt = max(cnt, ted[i]);
  for (int i = 1; i <= n - 1; ++i) {
    if (ted[i] == cnt) ans.push_back(i);
  }
  cout << cnt * 2 << ' ' << ans.size() << '\n';
  for (int i : ans) cout << i << ' ';
}
