#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 30, Mod = 1e9 + 7;
const long long SQ = 330;
map<long long, vector<long long> > mp;
pair<long long, long long> E[N];
long long p[N], sz[N], M[N], cnt[N];
vector<long long> G[N];
long long r[N], ans[N];
void DFS(long long v, long long R) {
  cnt[v] = sz[v];
  M[v] = 1;
  r[v] = R;
  for (auto u : G[v]) {
    if (!M[u]) {
      DFS(u, R);
      cnt[v] += cnt[u];
    }
  }
}
long long get(long long x) { return (p[x] ? p[x] = get(p[x]) : x); }
void add(long long x, long long y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (rand() % 2) swap(x, y);
  p[x] = y;
  sz[y] += sz[x];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long n;
  cin >> n;
  fill(sz, sz + N, 1);
  for (int i = 1; i < n; i++) {
    long long v, u, w;
    cin >> v >> u >> w;
    mp[w].push_back(i);
    E[i] = {v, u};
  }
  for (auto R : mp) {
    vector<long long> V = R.second;
    set<long long> second;
    for (auto x : V) {
      second.insert(get(E[x].first));
      second.insert(get(E[x].second));
    }
    for (auto x : second) G[x].clear(), M[x] = false, cnt[x] = 0;
    for (auto x : V) {
      G[get(E[x].first)].push_back(get(E[x].second));
      G[get(E[x].second)].push_back(get(E[x].first));
    }
    for (auto u : second)
      if (!M[u]) DFS(u, u);
    for (auto x : V) {
      long long v = E[x].first, u = E[x].second;
      v = get(v);
      u = get(u);
      if (cnt[v] > cnt[u]) swap(v, u);
      ans[x] = cnt[v] * (cnt[r[v]] - cnt[v]);
    }
    for (auto x : V) add(E[x].first, E[x].second);
  }
  long long mx = 0;
  for (int i = 1; i < n; i++) mx = max(mx, ans[i]);
  long long C = 0;
  for (int i = 1; i < n; i++)
    if (ans[i] == mx) C++;
  cout << 2 * mx << ' ' << C << '\n';
  for (int i = 1; i < n; i++)
    if (ans[i] == mx) cout << i << ' ';
  return (0);
}
