#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
const long long MAXN = 1e6 + 10;
const long long INF = 8e18;
const long long MOD = 1e9 + 7;
int C[MAXN], UC[MAXN], dp[MAXN], par[MAXN], par_p[MAXN], n, H[MAXN], ht[MAXN],
    tot;
bool vis[MAXN], in[MAXN];
vector<int> C_adj[MAXN], D[MAXN], moved_el, st;
vector<pair<int, int>> vec;
vector<pair<long long, long long>> ans;
vector<pair<int, pair<int, int>>> edges;
map<pair<int, int>, int> mp;
void dfs(int v, int p) {
  vis[v] = true;
  dp[v] = C[v];
  ht[v] = 1;
  for (int u : C_adj[v]) {
    if (u != p) {
      dfs(u, v);
      dp[v] += dp[u];
      ht[v] = max(ht[v], ht[u] + 1);
    }
  }
}
inline void Add(int v) {
  dp[v] = 1;
  C[v] = UC[v] = 1;
  par[v] = par_p[v] = v;
  D[v].push_back(v);
}
inline void Union(int v, int u) {
  int tv = v, tu = u;
  v = par[v];
  u = par[u];
  if (D[v].size() > D[u].size()) swap(u, v), swap(tv, tu);
  vec.push_back({par_p[tv], par_p[tu]});
  UC[u] += UC[v];
  C_adj[par_p[tv]].push_back(par_p[tu]);
  C_adj[par_p[tu]].push_back(par_p[tv]);
  st.push_back(par_p[tv]);
  st.push_back(par_p[tu]);
  for (int e : D[v]) {
    par[e] = u;
    D[u].push_back(e);
    moved_el.push_back(e);
  }
  D[v].clear();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) Add(i);
  for (int i = 1; i < n; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    edges.push_back({w, {u, v}});
    mp[make_pair(u, v)] = i;
    mp[make_pair(v, u)] = i;
  }
  sort((edges).begin(), (edges).end());
  for (int i = 0; i < n - 1; i++) {
    Union(edges[i].second.first, edges[i].second.second);
    if (i == n - 2 || edges[i].first != edges[i + 1].first) {
      for (int ind : st) {
        if (!vis[ind]) {
          dfs(ind, 0);
        }
      }
      for (int j = 0; j < vec.size(); j++) {
        int tind = i - vec.size() + j + 1;
        int ind =
            mp[make_pair(edges[tind].second.first, edges[tind].second.second)];
        int u = vec[j].first, v = vec[j].second;
        if (ht[u] < ht[v]) swap(v, u);
        long long tans =
            1ll * dp[v] * (UC[par[edges[tind].second.second]] - dp[v]);
        ans.push_back({tans, ind});
      }
      vec.clear();
      for (int e : st) {
        C_adj[e].clear();
        C[e] = UC[e];
        vis[e] = false;
      }
      for (int e : moved_el) {
        par_p[e] = par[e];
      }
      moved_el.clear();
      st.clear();
    }
  }
  sort((ans).begin(), (ans).end());
  reverse((ans).begin(), (ans).end());
  while (ans.front().first != ans.back().first) ans.pop_back();
  cout << 2 * ans.front().first << ' ' << ans.size() << '\n';
  reverse((ans).begin(), (ans).end());
  for (auto e : ans) cout << e.second << ' ';
  cout << '\n';
  return 0;
}
