#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
const double INF = 1e12, EPS = 1e-9;
struct edge {
  int u, v, w, id;
  bool operator<(const edge &r) const { return w < r.w; }
};
edge es[100000];
int n;
int p[100000], sz[100000];
int root(int x) {
  if (x == p[x]) return x;
  return p[x] = root(p[x]);
}
void merge(int a, int b) {
  a = root(a);
  b = root(b);
  if (a == b) return;
  p[a] = b;
  sz[b] += sz[a];
}
int cnt, cur;
long long ans[100000], mx;
int dp[200000], dpi[200000];
vector<edge> graph[100000];
int dfs(int u, int prev, int id) {
  if (dpi[id] == cur) return dp[id];
  int res = sz[root(u)];
  for (int i = 0; i < graph[u].size(); i++) {
    int v = graph[u][i].v, nid = graph[u][i].id;
    if (v != prev) res += dfs(v, u, nid);
  }
  dpi[id] = cur;
  return dp[id] = res;
}
void run() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int u, v, w;
    cin >> u >> v >> w;
    es[i] = (edge){u - 1, v - 1, w, i};
    dpi[i] = dpi[i + n] = -1;
  }
  sort(es, es + n - 1);
  for (int i = 0; i < n; i++) p[i] = i, sz[i] = 1;
  mx = -1;
  for (int i = 0; i < n - 1; i++) {
    vector<edge> e;
    for (int j = i; j < n - 1 && es[j].w == es[i].w; j++) {
      e.push_back(es[j]);
      int u = root(es[j].u), v = root(es[j].v), id = es[j].id;
      graph[u].push_back((edge){u, v, 0, id});
      graph[v].push_back((edge){v, u, 0, id + n});
    }
    cur = i;
    for (int j = 0; j < e.size(); j++) {
      int u = root(e[j].u), v = root(e[j].v), id = e[j].id;
      ans[e[j].id] = 2ll * dfs(v, u, id) * dfs(u, v, id + n);
      if (ans[e[j].id] > mx) mx = ans[e[j].id], cnt = 0;
      if (ans[e[j].id] == mx) cnt++;
    }
    for (int j = 0; j < e.size(); j++) {
      int u = root(e[j].u), v = root(e[j].v);
      graph[u].clear();
      graph[v].clear();
      merge(u, v);
    }
    i += e.size() - 1;
  }
  cout << mx << " " << cnt << endl;
  for (int i = 0; i < n - 1; i++)
    if (ans[i] == mx) cout << i + 1 << " ";
  cout << endl;
}
int main() { run(); }
