#include <bits/stdc++.h>
using namespace std;
long long ans[100005];
int n;
long long vis[100005];
vector<pair<int, int> > v[100005];
struct node {
  int from, to, dist, id;
  node(int from, int to, int dist, int id)
      : from(from), to(to), dist(dist), id(id) {}
};
bool comp(node a, node b) { return a.dist < b.dist; }
int sz[100005], parent[100005];
vector<node> edges;
int find_set(int x) {
  if (x != parent[x]) parent[x] = find_set(parent[x]);
  return parent[x];
}
void dfs(int cur, int prev) {
  vis[cur] = sz[cur];
  for (int i = 0; i < v[cur].size(); i++) {
    int node = v[cur][i].first, pt = v[cur][i].second;
    if (node == prev) continue;
    dfs(node, cur);
    vis[cur] += vis[node];
  }
}
long long tot = 0;
void dfs2(int cur, int prev) {
  vis[cur] = sz[cur];
  for (int i = 0; i < v[cur].size(); i++) {
    int node = v[cur][i].first, pt = v[cur][i].second;
    if (node == prev) continue;
    dfs2(node, cur);
    vis[cur] += vis[node];
    ans[pt] = vis[node] * 1ll * (tot - vis[node]) * 2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    int d;
    cin >> a >> b >> d;
    edges.push_back(node(a, b, d, i));
  }
  sort(edges.begin(), edges.end(), comp);
  for (int i = 1; i <= n; i++) {
    parent[i] = i;
    sz[i] = 1;
  }
  vector<int> to_clear;
  int l = 0, r = 0;
  for (int i = 1; i < edges.size(); i++) {
    if (edges[i].dist == edges[l].dist) {
      r++;
    } else {
      for (int k = l; k <= r; k++) {
        int px = find_set(edges[k].from);
        int py = find_set(edges[k].to);
        v[px].push_back(make_pair(py, edges[k].id));
        v[py].push_back(make_pair(px, edges[k].id));
        to_clear.push_back(px);
        to_clear.push_back(py);
      }
      for (int k = 0; k < to_clear.size(); k++) {
        if (vis[to_clear[k]] == 0) {
          dfs(to_clear[k], -1);
          tot = vis[to_clear[k]];
          dfs2(to_clear[k], -1);
        }
      }
      for (int k = 0; k < to_clear.size(); k++) {
        vis[to_clear[k]] = 0;
        v[to_clear[k]].clear();
      }
      to_clear.clear();
      for (int k = l; k <= r; k++) {
        int px = find_set(edges[k].from);
        int py = find_set(edges[k].to);
        if (px != py) {
          if (sz[px] < sz[py])
            parent[px] = py, sz[py] += sz[px];
          else
            parent[py] = px, sz[px] += sz[py];
        }
      }
      r += 1;
      l = r;
    }
  }
  for (int k = l; k <= r; k++) {
    int px = find_set(edges[k].from);
    int py = find_set(edges[k].to);
    v[px].push_back(make_pair(py, edges[k].id));
    v[py].push_back(make_pair(px, edges[k].id));
    to_clear.push_back(px);
    to_clear.push_back(py);
  }
  for (int k = 0; k < to_clear.size(); k++) {
    if (vis[to_clear[k]] == 0) {
      dfs(to_clear[k], -1);
      tot = vis[to_clear[k]];
      dfs2(to_clear[k], -1);
    }
  }
  for (int k = 0; k < to_clear.size(); k++) {
    vis[to_clear[k]] = 0;
  }
  for (int k = l; k <= r; k++) {
    int px = find_set(edges[k].from);
    int py = find_set(edges[k].to);
    if (px != py) {
      if (sz[px] < sz[py])
        parent[px] = py, sz[py] += sz[px];
      else
        parent[py] = px, sz[px] += sz[py];
    }
  }
  long long maxi = ans[1], num = 1;
  for (int i = 2; i <= n - 1; i++) {
    if (ans[i] < maxi) continue;
    if (ans[i] > maxi) {
      num = 1;
      maxi = ans[i];
    } else {
      num++;
    }
  }
  cout << maxi << " " << num << "\n";
  for (int i = 1; i <= n - 1; i++) {
    if (ans[i] == maxi) {
      cout << i << " ";
    }
  }
  cout << "\n";
  return 0;
}
