#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int NMAX = 300000;
struct edge {
  int ind, a, b, d;
  long long cnt;
};
bool operator<(const edge& e1, const edge& e2) { return e1.d < e2.d; }
int N;
edge E[NMAX - 1];
int cnt[NMAX], par[NMAX];
int V[2 * NMAX], size_tree[NMAX], size_all[NMAX], depth[NMAX];
bool vis[NMAX];
vector<int> G[NMAX];
int set_find(int a) {
  if (a == par[a]) return a;
  return par[a] = set_find(par[a]);
}
int DFS_tree(int u, int d) {
  vis[u] = true;
  depth[u] = d;
  size_tree[u] = cnt[u];
  for (int i = 0, _n = (G[u].size()); i < _n; ++i)
    if (!vis[G[u][i]]) size_tree[u] += DFS_tree(G[u][i], d + 1);
  return size_tree[u];
}
void DFS_all(int u, int size) {
  vis[u] = true;
  size_all[u] = size;
  for (int i = 0, _n = (G[u].size()); i < _n; ++i)
    if (!vis[G[u][i]]) DFS_all(G[u][i], size);
}
int main() {
  cin >> N;
  for (int i = 0, _n = (N - 1); i < _n; ++i) {
    cin >> E[i].a >> E[i].b >> E[i].d;
    --E[i].a;
    --E[i].b;
    E[i].ind = i;
  }
  sort(E, E + (N - 1));
  for (int i = 0, _n = (N); i < _n; ++i) {
    cnt[i] = 1;
    par[i] = i;
  }
  for (int i = 0; i < N - 1;) {
    int j = i + 1;
    while (j < N - 1 && E[j].d == E[i].d) ++j;
    int NV = 0;
    for (int k = (i), _n = (j - 1); k <= _n; ++k) {
      V[NV++] = set_find(E[k].a);
      V[NV++] = set_find(E[k].b);
    }
    sort(V, V + NV);
    NV = unique(V, V + NV) - V;
    for (int k = (i), _n = (j - 1); k <= _n; ++k) {
      int a = set_find(E[k].a), b = set_find(E[k].b);
      G[a].push_back(b);
      G[b].push_back(a);
    }
    for (int ii = 0, _n = (NV); ii < _n; ++ii)
      if (!vis[V[ii]]) size_all[V[ii]] = DFS_tree(V[ii], 0);
    for (int ii = 0, _n = (NV); ii < _n; ++ii) vis[V[ii]] = false;
    for (int ii = 0, _n = (NV); ii < _n; ++ii)
      if (!vis[V[ii]]) DFS_all(V[ii], size_all[V[ii]]);
    for (int ii = 0, _n = (NV); ii < _n; ++ii) vis[V[ii]] = false;
    for (int ii = 0, _n = (NV); ii < _n; ++ii) G[V[ii]].clear();
    for (int k = (i), _n = (j - 1); k <= _n; ++k) {
      int a = set_find(E[k].a), b = set_find(E[k].b);
      if (depth[a] > depth[b]) swap(a, b);
      E[k].cnt = 2LL * size_tree[b] * (size_all[b] - size_tree[b]);
    }
    for (int k = (i), _n = (j - 1); k <= _n; ++k) {
      int a = set_find(E[k].a), b = set_find(E[k].b);
      if (cnt[a] < cnt[b]) swap(a, b);
      cnt[a] += cnt[b];
      par[b] = a;
    }
    i = j;
  }
  long long maks = 0;
  vector<int> res;
  for (int i = 0, _n = (N - 1); i < _n; ++i) {
    if (E[i].cnt > maks) {
      maks = E[i].cnt;
      res.clear();
      res.push_back(E[i].ind);
    } else if (E[i].cnt == maks) {
      res.push_back(E[i].ind);
    }
  }
  sort((res).begin(), (res).end());
  cout << maks << " " << res.size() << "\n";
  for (int i = 0, _n = (res.size()); i < _n; ++i) {
    cout << res[i] + 1;
    if (i < (int)res.size() - 1) cout << " ";
  }
  cout << "\n";
}
