#include <bits/stdc++.h>
using namespace std;
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
int par[100010];
int rank_of[100010];
long long sz[100010];
void make_set(int nein) {
  for (int i = 1; i <= nein; i++) {
    par[i] = i;
    sz[i] = 1;
  }
}
int find_rep(int i) {
  if (i != par[i]) {
    par[i] = find_rep(par[i]);
  }
  return par[i];
}
bool is_uni(int u, int v) {
  int par_u = find_rep(u);
  int par_v = find_rep(v);
  if (par_u == par_v) {
    return true;
  }
  return false;
}
void union_node(int u, int v) {
  int par_u = find_rep(u);
  int par_v = find_rep(v);
  if (par_u == par_v) {
    return;
  }
  if (rank_of[par_u] == rank_of[par_v]) {
    rank_of[par_u]++;
    par[par_v] = par_u;
    sz[par_u] = sz[par_u] + sz[par_v];
    sz[par_v] = 0;
  } else if (rank_of[par_u] > rank_of[par_v]) {
    par[par_v] = par_u;
    sz[par_u] = sz[par_u] + sz[par_v];
    sz[par_v] = 0;
  } else {
    par[par_u] = par_v;
    sz[par_v] = sz[par_u] + sz[par_v];
    sz[par_u] = 0;
  }
}
int n;
class edge {
 public:
  int u, v;
  long long w;
  int pos;
  edge() {}
  edge(int a, int b, long long c, int d) {
    u = a;
    v = b;
    w = c;
    pos = d;
  }
};
class cmp {
 public:
  bool operator()(edge a, edge b) { return a.w < b.w; }
};
long long ans[100010];
vector<int> adjl[100010], pos[100010];
vector<edge> vv;
long long sub[100010];
bool vis[100010];
long long mot;
long long ff1(int u, int par) {
  vis[u] = 1;
  long long shu = sz[u];
  for (int i = 0; i <= (int)adjl[u].size() - 1; i++) {
    int v = adjl[u][i];
    if (v == par) {
      continue;
    }
    shu += ff1(v, u);
  }
  return sub[u] = shu;
}
void ff2(int u, int par) {
  for (int i = 0; i <= (int)adjl[u].size() - 1; i++) {
    int v = adjl[u][i];
    if (v == par) {
      continue;
    }
    int pp = pos[u][i];
    long long a = sub[v];
    long long b = mot - sub[v];
    ans[pp] = a * b;
    ff2(v, u);
  }
}
vector<edge> tmp;
vector<int> pr;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  memset(rank_of, 0, sizeof(rank_of));
  make_set(n);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    long long w;
    cin >> u >> v >> w;
    vv.push_back(edge(u, v, w, i));
  }
  sort(vv.begin(), vv.end(), cmp());
  for (int i = 0; i <= (int)vv.size() - 1; i++) {
    int j = i;
    while (j < (int)vv.size() && vv[j].w == vv[i].w) {
      j++;
    }
    j--;
    tmp.clear();
    for (int k = i; k <= j; k++) {
      tmp.push_back(
          edge(find_rep(vv[k].u), find_rep(vv[k].v), vv[k].w, vv[k].pos));
    }
    for (int k = 0; k <= (int)tmp.size() - 1; k++) {
      adjl[tmp[k].u].clear();
      pos[tmp[k].u].clear();
      adjl[tmp[k].v].clear();
      pos[tmp[k].v].clear();
      vis[tmp[k].u] = 0;
      vis[tmp[k].v] = 0;
    }
    for (int k = 0; k <= (int)tmp.size() - 1; k++) {
      adjl[tmp[k].u].push_back(tmp[k].v);
      pos[tmp[k].u].push_back(tmp[k].pos);
      adjl[tmp[k].v].push_back(tmp[k].u);
      pos[tmp[k].v].push_back(tmp[k].pos);
    }
    for (int k = 0; k <= (int)tmp.size() - 1; k++) {
      if (vis[tmp[k].u]) {
        continue;
      }
      mot = ff1(tmp[k].u, 0);
      ff2(tmp[k].u, 0);
    }
    for (int k = i; k <= j; k++) {
      if (!is_uni(vv[k].u, vv[k].v)) {
        union_node(vv[k].u, vv[k].v);
      }
    }
    i = j;
  }
  long long mx = 0;
  for (int i = 1; i <= n - 1; i++) {
    mx = max(mx, ans[i]);
  }
  for (int i = 1; i <= n - 1; i++) {
    if (ans[i] == mx) {
      pr.push_back(i);
    }
  }
  cout << mx * 2LL << " " << pr.size() << "\n";
  for (int i = 0; i <= (int)pr.size() - 1; i++) {
    cout << pr[i] << " ";
  }
  return 0;
}
