#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int u, v, w, id;
  bool operator<(const Edge &e) const { return w < e.w; }
} edges[100010];
int n, sum_ver, lab[100010], flag[100010];
long long max_tree = 0;
vector<pair<int, int> > adj[100010];
vector<int> res;
int getRoot(int v) {
  if (lab[v] < 0) return v;
  lab[v] = getRoot(lab[v]);
  return lab[v];
}
void unionTree(int r1, int r2) {
  r1 = getRoot(r1);
  r2 = getRoot(r2);
  if (r1 == r2) return;
  int x = lab[r1] + lab[r2];
  if (lab[r1] > lab[r2]) {
    lab[r1] = r2;
    lab[r2] = x;
  } else {
    lab[r1] = x;
    lab[r2] = r1;
  }
}
void dfs_sum(int u) {
  flag[u] = 1;
  sum_ver -= lab[u];
  for (int i = 0; i < adj[u].size(); i++)
    if (!flag[adj[u][i].first]) dfs_sum(adj[u][i].first);
}
long long dfs(int u) {
  flag[u] = 2;
  int value = 0;
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i].first, id = adj[u][i].second;
    if (flag[v] == 2) continue;
    int num = dfs(v);
    long long tree = (long long)(sum_ver - num) * num * 2LL;
    if (tree >= max_tree) {
      if (tree > max_tree) {
        res.clear();
        max_tree = tree;
      }
      res.push_back(id);
    }
    value += num;
  }
  return value - lab[u];
}
void solve() {
  sort(edges, edges + n - 1);
  for (int i = 0; i < n - 1;) {
    int j = i + 1;
    while (j < n - 1 && edges[i].w == edges[j].w) j++;
    set<int> ver;
    for (int k = i; k < j; k++) {
      edges[k].u = getRoot(edges[k].u);
      edges[k].v = getRoot(edges[k].v);
      ver.insert(edges[k].u);
      ver.insert(edges[k].v);
    }
    set<int>::iterator it = ver.begin();
    while (it != ver.end()) {
      adj[*it].clear();
      flag[*it] = 0;
      ++it;
    }
    for (int k = i; k < j; k++) {
      adj[edges[k].u].push_back(pair<int, int>(edges[k].v, edges[k].id));
      adj[edges[k].v].push_back(pair<int, int>(edges[k].u, edges[k].id));
    }
    it = ver.begin();
    while (it != ver.end()) {
      if (!flag[*it]) {
        sum_ver = 0;
        dfs_sum(*it);
        dfs(*it);
      }
      ++it;
    }
    for (int k = i; k < j; k++) unionTree(edges[k].u, edges[k].v);
    i = j;
  }
  printf("%I64d %d\n", max_tree, res.size());
  sort(res.begin(), res.end());
  for (int i = 0; i < res.size(); i++) printf("%d ", res[i] + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d %d", &edges[i].u, &edges[i].v, &edges[i].w);
    edges[i].id = i;
  }
  for (int i = 1; i <= n; i++) lab[i] = -1;
  solve();
  return 0;
}
