#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 13;
long long sz[maxN], mx, ans[maxN], dpd[maxN], dpu[maxN], a[maxN], b[maxN],
    w[maxN];
int par[maxN], n;
bool seen[maxN], mark[maxN];
vector<pair<int, int>> g[maxN];
vector<int> vec, edge;
map<pair<int, int>, int> mp;
int get_par(int x) {
  if (par[x] == x) return x;
  return par[x] = get_par(par[x]);
}
void dfsd(int x, int par) {
  mark[x] = 1;
  dpd[x] = sz[x];
  for (auto a : g[x]) {
    int u = a.first, e = a.second;
    if (u != par) {
      dfsd(u, x);
      dpd[x] += dpd[u];
    }
  }
}
bool cmp(int i, int j) {
  if (w[i] != w[j]) return w[i] < w[j];
  return i < j;
}
void dfsu(int x, int par) {
  for (auto a : g[x]) {
    int u = a.first, e = a.second;
    if (u != par) {
      dpu[u] = dpu[x] + dpd[x] - dpd[u];
      ans[e] = dpu[u] * dpd[u] * 2;
      dfsu(u, x);
    }
  }
  g[x].clear();
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> a[i] >> b[i] >> w[i];
    edge.push_back(i);
  }
  for (int i = 1; i <= n; i++) sz[i] = 1, par[i] = i;
  sort(edge.begin(), edge.end(), cmp);
  for (int i = 0; i < edge.size();) {
    int cnt = i + 1;
    vector<int> cnd;
    while (cnt < edge.size() && w[edge[i]] == w[edge[cnt]]) {
      cnt++;
    }
    for (int j = i; j < cnt; j++) {
      int u = a[edge[j]], v = b[edge[j]];
      int p1 = get_par(u), p2 = get_par(v);
      if (!seen[p1]) {
        seen[p1] = 1;
        cnd.push_back(p1);
      }
      if (!seen[p2]) {
        seen[p2] = 1;
        cnd.push_back(p2);
      }
      g[p1].push_back({p2, edge[j]});
      g[p2].push_back({p1, edge[j]});
    }
    for (auto a : cnd) {
      if (!mark[a]) {
        dfsd(a, a);
        dfsu(a, a);
      }
    }
    cnd.clear();
    for (int j = i; j < cnt; j++) {
      int u = a[edge[j]], v = b[edge[j]];
      int p1 = get_par(u), p2 = get_par(v);
      seen[p1] = 0, seen[p2] = 0;
      dpu[p1] = 0, dpu[p2] = 0;
      mark[p1] = 0, mark[p2] = 0;
      par[p2] = p1;
      sz[p1] += sz[p2];
    }
    i = cnt;
  }
  for (int i = 0; i < n - 1; i++) {
    mx = max(mx, ans[i]);
  }
  for (int i = 0; i < n - 1; i++) {
    if (ans[i] == mx) vec.push_back(i + 1);
  }
  cout << mx << " " << vec.size() << endl;
  for (auto a : vec) cout << a << " ";
}
