#include <bits/stdc++.h>
using namespace std;
int n, i, j, p[100005], siz[100005], subsiz[100005], tot;
long long ans[100005];
bool used[100005];
struct dat {
  int from, to, val, id;
  bool operator<(const dat& T) const { return val < T.val; }
};
int find(int s) {
  if (s == p[s]) return s;
  return p[s] = find(p[s]);
}
vector<dat> edge[100005];
vector<pair<int, int> > to[100005];
vector<int> sol;
void pre(int id, int p) {
  used[id] = 1;
  tot += siz[id];
  for (int k = 0; k < to[id].size(); k++) {
    int too = to[id][k].first;
    if (too == p) continue;
    pre(too, id);
  }
}
void dfs(int id, int p) {
  subsiz[id] = siz[id];
  for (int k = 0; k < to[id].size(); k++) {
    int too = to[id][k].first;
    if (too == p) continue;
    dfs(too, id);
    subsiz[id] += subsiz[too];
    ans[to[id][k].second] += (long long)subsiz[too] * (tot - subsiz[too]);
  }
}
int main() {
  scanf("%d", &n);
  vector<dat> tmp;
  vector<int> v;
  for (i = 0; i < n - 1; i++) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    tmp.push_back({x, y, z, i});
    v.push_back(z);
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  for (i = 0; i < tmp.size(); i++) {
    tmp[i].val = lower_bound(v.begin(), v.end(), tmp[i].val) - v.begin();
    edge[tmp[i].val].push_back(tmp[i]);
  }
  for (i = 1; i <= n; i++) {
    p[i] = i;
    siz[i] = 1;
  }
  for (i = 0; i < v.size(); i++) {
    vector<int> id;
    for (j = 0; j < edge[i].size(); j++) {
      int u = find(edge[i][j].from);
      int v = find(edge[i][j].to);
      to[u].clear();
      to[v].clear();
      used[u] = 0;
      used[v] = 0;
      id.push_back(u);
      id.push_back(v);
    }
    sort(id.begin(), id.end());
    id.resize(unique(id.begin(), id.end()) - id.begin());
    for (j = 0; j < edge[i].size(); j++) {
      int u = find(edge[i][j].from);
      int v = find(edge[i][j].to);
      to[u].push_back({v, edge[i][j].id});
      to[v].push_back({u, edge[i][j].id});
    }
    for (j = 0; j < id.size(); j++) {
      int now = id[j];
      if (used[now]) continue;
      tot = 0;
      pre(now, -1);
      dfs(now, -1);
    }
    for (j = 0; j < edge[i].size(); j++) {
      int u = find(edge[i][j].from);
      int v = find(edge[i][j].to);
      if (u != v) {
        p[u] = v;
        siz[v] += siz[u];
      }
    }
  }
  long long res = 0;
  long long cnt = 0;
  for (i = 0; i < n - 1; i++) {
    if (2LL * ans[i] > res) {
      sol.clear();
      sol.push_back(i + 1);
      res = 2LL * ans[i];
      cnt = 1;
    } else if (2LL * ans[i] == res) {
      cnt++;
      sol.push_back(i + 1);
    }
  }
  printf("%lld %lld\n", res, cnt);
  for (i = 0; i < sol.size(); i++) {
    if (i == 0)
      printf("%d", sol[i]);
    else
      printf(" %d", sol[i]);
  }
  printf("\n");
}
