#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long inf = 1e18;
vector<int> adj[100009];
int par[100009], sz[100009];
int nxt() {
  int x;
  cin >> x;
  return x;
}
int fin(int v) {
  if (par[v] == v) return v;
  return par[v] = fin(par[v]);
}
void uni(int a, int b) {
  a = fin(a);
  b = fin(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  par[b] = a;
  sz[a] += sz[b];
}
struct edge {
  int a, b, c, d;
};
vector<edge> e;
bool cmp(edge A, edge B) { return A.c < B.c; }
int dp[100009], root[100009];
void dfs(int v) {
  dp[v] = sz[fin(v)];
  for (auto u : adj[v]) {
    if (!root[u]) {
      root[u] = root[v];
      dfs(u);
      dp[v] += dp[u];
    }
  }
}
void solve() {
  int n, i, j, k;
  n = nxt();
  e.resize(n);
  for (i = 1; i < n; i++) {
    e[i].a = nxt();
    e[i].b = nxt();
    e[i].c = nxt();
    e[i].d = i;
    sz[i] = 1;
    par[i] = i;
  }
  sz[n] = 1;
  par[n] = n;
  sort(1 + e.begin(), e.end(), cmp);
  long long ans = 0, temp;
  vector<int> v;
  for (i = 1, j = 1; i < n; i = j) {
    while (j < n && e[i].c == e[j].c) j++;
    for (k = i; k < j; k++) {
      e[k].a = fin(e[k].a);
      e[k].b = fin(e[k].b);
      adj[e[k].a].push_back(e[k].b);
      adj[e[k].b].push_back(e[k].a);
      root[e[k].b] = root[e[k].a] = 0;
    }
    for (k = i; k < j; k++) {
      if (!root[e[k].a]) {
        root[e[k].a] = e[k].a;
        dfs(e[k].a);
      }
    }
    for (k = i; k < j; k++) {
      long long small = min(dp[e[k].a], dp[e[k].b]);
      long long large = dp[root[e[k].a]];
      temp = small * (large - small);
      if (temp > ans) {
        ans = temp;
        v.clear();
        v.push_back(e[k].d);
      } else if (temp == ans) {
        v.push_back(e[k].d);
      }
    }
    for (k = i; k < j; k++) {
      adj[e[k].a].clear();
      adj[e[k].b].clear();
      uni(e[k].a, e[k].b);
    }
  }
  ans <<= 1;
  sort(v.begin(), v.end());
  cout << ans << ' ' << v.size() << '\n';
  for (auto u : v) cout << u << ' ';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
