#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
struct yal {
  int a, b, i;
};
struct second {
  int to, i;
};
map<int, vector<yal> > mp;
map<long long, vector<int> > ans;
vector<second> adj[N];
vector<int> v;
int D[N], n;
long long SZ[N], AH[N];
int get(int a) { return (!D[a] ? a : D[a] = get(D[a])); }
void merg(int a, int b) {
  a = get(a);
  b = get(b);
  SZ[a] += SZ[b];
  D[b] = a;
}
long long DFS(int u, int p, int i) {
  AH[i] = SZ[u];
  for (second x : adj[u])
    if (x.to ^ p) AH[i] += DFS(x.to, u, x.i);
  adj[u].clear();
  v.push_back(i);
  return (AH[i]);
}
int main() {
  fill(SZ, SZ + N, 1);
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b, d;
    scanf("%d %d %d", &a, &b, &d);
    yal y = {a, b, i};
    mp[d].push_back(y);
  }
  for (auto x : mp) {
    set<int> st;
    for (yal y : x.second) {
      int a = get(y.a), b = get(y.b);
      second s = {b, y.i};
      adj[a].push_back(s);
      s.to = a;
      adj[b].push_back(s);
      st.insert(a);
    }
    for (int z : st)
      if (adj[z].size()) {
        int sz = DFS(z, 0, 0);
        for (int ah : v) ans[-2 * AH[ah] * (sz - AH[ah])].push_back(ah);
        v.clear();
      }
    for (yal y : x.second) merg(y.a, y.b);
  }
  printf("%lld %d\n", -(ans.begin()->first), (int)(ans.begin()->second).size());
  sort((ans.begin()->second).begin(), (ans.begin()->second).end());
  for (int x : (ans.begin()->second)) printf("%d ", x);
}
