#include <bits/stdc++.h>
using namespace std;
struct edge {
  int a, b, c;
} e[100005];
int n, tot;
int sub[100005], vis[100005];
int dad[100005], sz[100005];
long long cnt[100005];
vector<int> v[100005];
vector<int> edges;
int find(int node) {
  return dad[node] = (dad[node] == node ? node : find(dad[node]));
}
void merge(int x, int y) {
  if ((x = find(x)) == (y = find(y))) return;
  dad[x] = y;
  sz[y] += sz[x];
}
void dfs2(int node, int ata) {
  for (auto i : v[node]) {
    int go = node ^ e[i].a ^ e[i].b;
    if (go == ata) continue;
    dfs2(go, node);
    cnt[i] = (long long)(tot - sub[go]) * sub[go] * 2;
  }
}
void dfs(int node, int ata) {
  vis[node] = 1;
  sub[node] = sz[node];
  for (auto i : v[node]) {
    int go = node ^ e[i].a ^ e[i].b;
    if (go == ata) continue;
    dfs(go, node);
    sub[node] += sub[go];
  }
}
void update(int l, int r) {
  vector<int> nodes;
  for (int i = l; i <= r; i++) {
    e[edges[i]].a = find(e[edges[i]].a);
    e[edges[i]].b = find(e[edges[i]].b);
    nodes.push_back(e[edges[i]].a);
    nodes.push_back(e[edges[i]].b);
    v[e[edges[i]].a].push_back(edges[i]);
    v[e[edges[i]].b].push_back(edges[i]);
  }
  sort(nodes.begin(), nodes.end());
  nodes.erase(unique(nodes.begin(), nodes.end()), nodes.end());
  for (int i : nodes) {
    if (vis[i]) continue;
    dfs(i, 0);
    tot = sub[i];
    dfs2(i, 0);
  }
  for (int i : nodes) {
    v[i].clear();
    vis[i] = 0;
  }
  for (int i = l; i <= r; i++) {
    merge(e[edges[i]].a, e[edges[i]].b);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) dad[i] = i, sz[i] = 1;
  for (int i = 1; i < n; i++) {
    scanf("%d %d %d", &e[i].a, &e[i].b, &e[i].c);
    edges.push_back(i);
  }
  sort(edges.begin(), edges.end(),
       [](int x, int y) { return e[x].c < e[y].c; });
  for (int i = 0; i < n - 1; i++) {
    int l = i;
    while (i + 1 < n - 1 && e[edges[i]].c == e[edges[i + 1]].c) i++;
    update(l, i);
  }
  vector<int> ans_set;
  long long ans = -1000000000;
  for (int i = 1; i < n; i++) {
    if (cnt[i] > ans) {
      ans_set.clear();
      ans = cnt[i];
    }
    if (cnt[i] == ans) ans_set.push_back(i);
  }
  printf("%lld %d\n", ans, ((int)ans_set.size()));
  for (auto x : ans_set) printf("%d ", x);
}
