#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
int in[MAXN], out[MAXN];
int n, parent[MAXN], sz[MAXN], dep[MAXN], timer = 0;
int vis[MAXN];
long long cnt[MAXN];
vector<pair<int, int> > tree[MAXN];
vector<pair<long long, int> > ans;
vector<int> comp, pro[MAXN];
struct edge {
  int u, v, w, idx;
  void read(int idx) {
    cin >> u >> v >> w;
    this->idx = idx;
  }
  bool operator<(const edge e) const { return w < e.w; }
} e[MAXN];
int find(int u) { return u == parent[u] ? u : parent[u] = find(parent[u]); }
void mrg(int u, int v) {
  u = find(u), v = find(v);
  if (u == v) return;
  parent[u] = v;
  sz[v] += sz[u];
}
void dfs(int here, int dad) {
  cnt[here] = sz[here];
  for (int i = 0; i < tree[here].size(); i++) {
    int there = tree[here][i].first;
    if (there == dad) continue;
    dfs(there, here);
    cnt[here] += cnt[there];
  }
}
void getAns(int root, int here, int dad, int w) {
  for (int i = 0; i < tree[here].size(); i++) {
    int there = tree[here][i].first;
    int idx = tree[here][i].second;
    if (there != dad) {
      getAns(root, there, here, w);
      if (e[idx].w == w) {
        ans.push_back({cnt[there] * (cnt[root] - cnt[there]) * 2, idx});
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < MAXN; i++) parent[i] = i, sz[i] = 1;
  for (int i = 1; i <= n - 1; i++) {
    e[i].read(i);
    comp.push_back(e[i].w);
  }
  sort(comp.begin(), comp.end());
  comp.erase(unique(comp.begin(), comp.end()), comp.end());
  for (int i = 1; i <= n - 1; i++) {
    e[i].w = lower_bound(comp.begin(), comp.end(), e[i].w) - comp.begin() + 1;
    pro[e[i].w].push_back(e[i].idx);
  }
  for (int i = 1; i < MAXN; i++) {
    for (int j = 0; j < pro[i].size(); j++) {
      int idx = pro[i][j];
      int u = e[idx].u, v = e[idx].v, w = e[idx].w;
      u = find(u), v = find(v);
      vis[u] = vis[v] = 0;
      cnt[u] = cnt[v] = 0;
      tree[find(u)].clear();
      tree[find(v)].clear();
    }
    for (int j = 0; j < pro[i].size(); j++) {
      int idx = pro[i][j];
      int u = e[idx].u, v = e[idx].v, w = e[idx].w;
      tree[find(u)].push_back({find(v), idx});
      tree[find(v)].push_back({find(u), idx});
    }
    for (int j = 0; j < pro[i].size(); j++) {
      int idx = pro[i][j];
      int u = e[idx].u, v = e[idx].v, w = e[idx].w;
      if (!cnt[find(u)]) {
        dfs(find(u), -1);
        getAns(find(u), find(u), -1, w);
      }
    }
    for (int j = 0; j < pro[i].size(); j++) {
      int idx = pro[i][j];
      int u = e[idx].u, v = e[idx].v, w = e[idx].w;
      mrg(u, v);
    }
  }
  sort(ans.begin(), ans.end());
  reverse(ans.begin(), ans.end());
  while (ans.back().first != ans.front().first) ans.pop_back();
  cout << ans[0].first << ' ' << ans.size() << "\n";
  vector<int> seq;
  for (int i = 0; i < ans.size(); i++) {
    seq.push_back(ans[i].second);
  }
  reverse(seq.begin(), seq.end());
  for (auto e : seq) {
    cout << e << ' ';
  }
  return 0;
}
