#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 100;
const long long mod = 1e9 + 7;
const long long inf = 1e18;
long long n, dsu[maxn], sz[maxn], dp[maxn], r[maxn], d[maxn], ans[maxn], x;
bool vis[maxn];
pair<pair<long long, long long>, pair<long long, long long> > e[maxn];
vector<pair<long long, long long> > g[maxn];
vector<long long> vec;
void initialize() {
  for (long long i = 1; i <= n; i++) {
    dsu[i] = i;
    sz[i] = 1;
  }
}
long long root(long long i) {
  if (dsu[i] == i) return dsu[i];
  dsu[i] = root(dsu[i]);
  return dsu[i];
}
bool find(long long i, long long j) { return (root(i) == root(j)); }
void Union(long long i, long long j) {
  if (find(i, j)) return;
  long long v = root(i), u = root(j);
  if (sz[v] > sz[u]) swap(v, u);
  dsu[v] = dsu[u];
  sz[u] += sz[v];
  return;
}
void dfs(long long v) {
  long long u;
  vis[v] = 1;
  dp[v] = sz[v];
  for (long long i = 0; i < g[v].size(); i++) {
    u = g[v][i].first;
    if (vis[u]) continue;
    r[u] = r[v];
    d[u] = g[v][i].second;
    dfs(u);
    dp[v] += dp[u];
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  initialize();
  for (long long i = 0; i < n - 1; i++) {
    cin >> e[i].second.first >> e[i].second.second >> e[i].first.first;
    e[i].first.second = i + 1;
  }
  sort(e, e + n - 1);
  for (long long i = 0; i < n - 1;) {
    long long j = i;
    while (j < n - 1 && e[i].first.first == e[j].first.first) {
      e[j].second.first = root(e[j].second.first);
      e[j].second.second = root(e[j].second.second);
      vec.push_back(e[j].second.first);
      vec.push_back(e[j].second.second);
      g[e[j].second.first].push_back({e[j].second.second, e[j].first.second});
      g[e[j].second.second].push_back({e[j].second.first, e[j].first.second});
      j++;
    }
    for (long long j = 0; j < vec.size(); j++) {
      if (vis[vec[j]]) continue;
      d[vec[j]] = 0;
      r[vec[j]] = vec[j];
      dfs(vec[j]);
    }
    for (long long j = 0; j < vec.size(); j++) {
      ans[d[vec[j]]] = dp[vec[j]] * (dp[r[vec[j]]] - dp[vec[j]]);
    }
    for (long long j = 0; j < vec.size(); j++) {
      g[vec[j]].clear();
      dp[vec[j]] = 0;
      vis[vec[j]] = 0;
    }
    vec.clear();
    while (i < j) {
      Union(e[i].second.first, e[i].second.second);
      i++;
    }
  }
  for (long long i = 1; i < n; i++) {
    if (ans[i] > x) {
      x = ans[i];
      vec.clear();
    }
    if (x == ans[i]) vec.push_back(i);
  }
  cout << x * 2 << " " << vec.size() << endl;
  sort(vec.begin(), vec.end());
  for (long long i = 0; i < vec.size(); i++) {
    cout << vec[i] << " ";
  }
  return 0;
}
