#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
template <typename T>
inline T Abs(T x) {
  return (x >= 0) ? x : -x;
}
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
inline string toStr(T x) {
  stringstream st;
  st << x;
  string s;
  st >> s;
  return s;
}
template <typename T>
inline int bit(T mask, int b) {
  return (b >= 0 && (mask & (T(1) << b)) != 0) ? 1 : 0;
}
inline int nextInt() {
  int x;
  if (scanf("%d", &x) != 1) throw;
  return x;
}
inline long long nextInt64() {
  long long x;
  if (scanf("%I64d", &x) != 1) throw;
  return x;
}
inline double nextDouble() {
  double x;
  if (scanf("%lf", &x) != 1) throw;
  return x;
}
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
const int MAXN = 200100;
int n, V[MAXN], U[MAXN], h[MAXN], lead[MAXN], prv[MAXN], size[MAXN];
map<int, vector<int> > m;
pair<int, int> d[MAXN];
vector<int> g[MAXN];
bool cmpByH(int a, int b) { return h[a] > h[b]; }
int leader(int v) {
  if (lead[v] != v) lead[v] = leader(lead[v]);
  return lead[v];
}
void merge(int v, int u) {
  v = leader(v);
  u = leader(u);
  size[u] += size[v];
  lead[v] = u;
}
void DFS(int v, int pr, int H) {
  prv[v] = pr;
  size[v] = 1;
  lead[v] = v;
  h[v] = H;
  for (int i = 0; i < (int)(g[v].size()); i++) {
    int u = g[v][i];
    if (u != pr) DFS(u, v, H + 1);
  }
}
int main() {
  n = nextInt();
  vector<int> l;
  for (int i = 0; i < (int)(n - 1); i++) {
    V[i] = nextInt() - 1;
    U[i] = nextInt() - 1;
    int w = nextInt();
    g[V[i]].push_back(U[i]);
    g[U[i]].push_back(V[i]);
    m[w].push_back(i);
    l.push_back(w);
  }
  DFS(0, -1, 0);
  sort((l).begin(), (l).end());
  l.erase(unique((l).begin(), (l).end()), l.end());
  for (int j = 0; j < (int)(l.size()); j++) {
    int w = l[j];
    vector<int> &p = m[w];
    vector<int> vv;
    for (int i = 0; i < (int)(p.size()); i++) {
      int id = p[i];
      if (h[V[id]] < h[U[id]]) swap(V[id], U[id]);
      vv.push_back(V[id]);
    }
    sort((vv).begin(), (vv).end(), cmpByH);
    for (int i = 0; i < (int)(vv.size()); i++) {
      int v = vv[i];
      d[v].second = size[v];
      merge(v, prv[v]);
    }
    for (int i = 0; i < (int)(vv.size()); i++) {
      int v = vv[i];
      d[v].first = size[leader(v)];
    }
  }
  long long ans = 0;
  vector<int> res;
  for (int i = 0; i < (int)(n - 1); i++) {
    int v = V[i], a = d[v].first, b = d[v].second;
    long long cur = 2LL * b * (a - b);
    if (cur > ans) {
      ans = cur;
      res.clear();
    }
    if (cur == ans) res.push_back(i);
  }
  cout << ans << " " << res.size() << endl;
  for (int i = 0; i < (int)(res.size()); i++) cout << res[i] + 1 << " ";
  return 0;
}
