#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101 * 1001;
struct yal {
  int u, v, w, ind;
};
int par[MAXN] = {}, par2[MAXN] = {};
;
long long sz[MAXN] = {}, dp[MAXN] = {}, ans[MAXN] = {};
vector<yal> a;
vector<pair<int, int> > adj[MAXN] = {};
bool mark[MAXN];
inline bool cmp(yal a, yal b) { return a.w < b.w; }
inline yal make_yal(int u, int v, int w, int ind) {
  yal ans;
  ans.u = u;
  ans.v = v;
  ans.w = w;
  ans.ind = ind;
  return ans;
}
inline int get_par(int u) {
  return (par[u] == u ? u : par[u] = get_par(par[u]));
}
inline void merge(int x, int y) {
  int a = get_par(x), b = get_par(y);
  if (a == b) return;
  if (sz[a] > sz[b]) swap(a, b);
  par[a] = b;
  sz[b] += sz[a];
}
vector<int> v, v2, as;
inline void dfs(int u, int p = -1) {
  v2.push_back(u);
  mark[u] = 1;
  dp[u] = sz[u];
  for (auto v : adj[u]) {
    if (v.first == p) continue;
    par2[v.first] = v.second;
    dfs(v.first, u);
    dp[u] += dp[v.first];
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int x, y, z;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d%d", &x, &y, &z);
    a.push_back(make_yal(x, y, z, i));
  }
  sort(a.begin(), a.end(), cmp);
  for (int i = 1; i <= n; i++) {
    mark[i] = sz[i] = 1, par[i] = i;
  }
  for (int i = 0; i < n - 1; i++) {
    v.clear();
    int j = i;
    while (a[j].w == a[i].w && j < n - 1) {
      x = get_par(a[j].u), y = get_par(a[j].v);
      if (mark[x]) {
        adj[x].clear();
        v.push_back(x);
        mark[x] = 0;
      }
      if (mark[y]) {
        adj[y].clear();
        v.push_back(y);
        mark[y] = 0;
      }
      adj[x].push_back({y, a[j].ind});
      adj[y].push_back({x, a[j].ind});
      j++;
    }
    for (auto u : v) {
      if (!mark[u]) {
        v2.clear();
        dfs(u);
        for (auto vv : v2) {
          if (vv == u) continue;
          ans[par2[vv]] = 2 * (dp[vv] * (dp[u] - dp[vv]));
        }
      }
    }
    for (int q = i; q < j; q++) merge(a[q].u, a[q].v);
    i = j - 1;
  }
  long long mx = 0;
  for (int i = 0; i < n - 1; i++) {
    if (ans[i] > mx) {
      as.clear();
      mx = ans[i];
    }
    if (ans[i] == mx) as.push_back(i);
  }
  printf("%I64d %d\n", mx, as.size());
  for (auto u : as) printf("%d ", u + 1);
}
