#include <bits/stdc++.h>
using namespace std;
int n, parent[100010];
struct edge {
  int x, y, ind, w;
  long long trees;
};
edge e[100010];
vector<edge> adj[100010];
int root(int i) { return parent[i] < 0 ? i : parent[i] = root(parent[i]); }
void merge(int x, int y) {
  if ((x = root(x)) == (y = root(y))) return;
  if (parent[x] < parent[y]) swap(x, y);
  parent[y] += parent[x];
  parent[x] = y;
}
int total_nodes;
int marked[100010];
int dfs(int node, bool type) {
  int sum = -parent[node];
  marked[node] = 1;
  for (int i = 0, sz = adj[node].size(); i < sz; i++) {
    if (marked[adj[node][i].x] == 0) {
      int reachable_nodes = dfs(adj[node][i].x, type);
      sum += reachable_nodes;
      e[adj[node][i].ind].trees = 2 * (long long)reachable_nodes *
                                  (long long)(total_nodes - reachable_nodes);
    }
  }
  if (type) marked[node] = 0;
  return sum;
}
vector<int> ans_ind;
bool cmp(edge x, edge y) { return x.w < y.w; };
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d %d", &e[i].x, &e[i].y, &e[i].w);
    e[i].ind = i + 1;
    e[i].trees = 0;
    e[i].x--, e[i].y--;
    parent[i] = -1;
  }
  parent[n - 1] = -1;
  sort(e, e + n - 1, cmp);
  for (int i = 0; i < n - 1;) {
    int preval = 0, preind = i;
    for (preval = e[i].w; i < n - 1 && preval == e[i].w; i++) {
      int x = root(e[i].x), y = root(e[i].y);
      edge temp = {y, 0, i, 0};
      adj[x].push_back(temp);
      temp.x = x;
      adj[y].push_back(temp);
    }
    for (int j = preind; j < i; j++) {
      int x = root(e[j].x);
      if (marked[x] == 0) {
        total_nodes = dfs(x, true);
        int dummy = dfs(x, false);
      }
    }
    for (int j = preind; j < i; j++) {
      int x = root(e[j].x), y = root(e[j].y);
      marked[x] = marked[y] = 0;
      adj[x].pop_back();
      adj[y].pop_back();
    }
    for (int j = preind; j < i; j++) merge(e[j].x, e[j].y);
  }
  long long maxi = e[0].trees;
  for (int i = 0; i < n - 1; i++) maxi = e[i].trees > maxi ? e[i].trees : maxi;
  for (int i = 0; i < n - 1; i++) {
    if (maxi == e[i].trees) ans_ind.push_back(e[i].ind);
  }
  sort(ans_ind.begin(), ans_ind.end());
  cout << maxi << " " << ans_ind.size() << endl;
  for (int i = 0, sz = ans_ind.size(); i < sz; i++) printf("%d ", ans_ind[i]);
  return 0;
}
