#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, pair<int, int> > > edges;
struct disjointset {
  vector<int> rank, parent, sz;
  int subtrees;
  disjointset(int n) {
    subtrees = n;
    for (int i = 0; i < n; i++)
      rank.push_back(1), parent.push_back(i), sz.push_back(1);
  }
  int find_set(int x) {
    if (x == parent[x]) return x;
    return parent[x] = find_set(parent[x]);
  }
  void link(int x, int y) {
    if (rank[x] > rank[y]) swap(x, y);
    parent[x] = y;
    sz[y] += sz[x];
    if (rank[x] == rank[y]) rank[y]++;
  }
  bool union_sets(int x, int y) {
    x = find_set(x), y = find_set(y);
    if (x != y) {
      link(x, y);
      subtrees--;
    }
    return x != y;
  }
  bool same_set(int x, int y) { return find_set(x) == find_set(y); }
} temp(100005);
long long res[100005];
bool v[100005];
vector<pair<int, int> > g[100005];
int tot = 0;
int dfs(int node, int parent) {
  v[node] = true;
  int sol = temp.sz[node];
  for (int i = 0; i < g[node].size(); i++) {
    int nxt = g[node][i].first;
    int ind = g[node][i].second;
    if (nxt == parent) continue;
    int cnt = dfs(nxt, node);
    res[ind] = cnt * 2LL * (tot - cnt);
    sol += cnt;
  }
  return sol;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int x, y, z, ind;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y >> z;
    edges.push_back(make_pair(make_pair(z, i), make_pair(x, y)));
  }
  sort(edges.begin(), edges.end());
  for (int i = 0; i < n - 1; i++) {
    z = edges[i].first.first;
    int k = 0;
    while (i + k < n - 1 && z == edges[i + k].first.first) k++;
    for (int j = i; j < i + k; j++) {
      x = edges[j].second.first;
      y = edges[j].second.second;
      x = temp.find_set(x);
      y = temp.find_set(y);
      g[x].clear();
      g[y].clear();
    }
    for (int j = i; j < i + k; j++) {
      x = edges[j].second.first;
      y = edges[j].second.second;
      ind = edges[j].first.second;
      x = temp.find_set(x);
      y = temp.find_set(y);
      v[x] = v[y] = false;
      g[x].push_back(make_pair(y, ind));
      g[y].push_back(make_pair(x, ind));
    }
    for (int j = i; j < i + k; j++) {
      x = edges[j].second.first;
      x = temp.find_set(x);
      if (!v[x]) {
        tot = dfs(x, -1);
        dfs(x, -1);
      }
    }
    for (int j = i; j < i + k; j++) {
      x = edges[j].second.first;
      y = edges[j].second.second;
      temp.union_sets(x, y);
    }
    i += k - 1;
  }
  long long maxi = -1;
  vector<int> v;
  for (int i = 0; i < n - 1; i++) {
    if (maxi < res[i]) {
      maxi = res[i];
      v.clear();
      v.push_back(i);
    } else if (maxi == res[i])
      v.push_back(i);
  }
  cout << maxi << " " << v.size() << "\n";
  for (int i = 0; i < v.size(); i++) cout << v[i] + 1 << " ";
  return 0;
}
