#include <bits/stdc++.h>
using namespace std;
const int M = 100010;
long long MAX = 0;
vector<int> maxs;
vector<int> A[M];
map<pair<int, int>, int> mep;
map<pair<int, int>, int> tmpmep;
map<int, vector<pair<int, int> > > edges;
int weight[M];
int parent[M];
int compsize[M];
int visited[M];
int dp[M];
int f(int first) {
  return parent[first] = parent[first] == first ? first : f(parent[first]);
}
void add(int a, int b) {
  int first = f(a), second = f(b);
  if (first != second) {
    parent[first] = second;
    compsize[second] += compsize[first];
  }
}
int dfs1(int first) {
  visited[first] = true;
  int sum = 0;
  for (int second : A[first])
    if (!visited[second]) sum += dfs1(second);
  return sum + compsize[first];
}
int dfs2(int first, int p, int total) {
  visited[first] = true;
  int sum = compsize[first];
  for (int second : A[first])
    if (!visited[second]) sum += dfs2(second, first, total);
  long long trees = (long long)sum * (long long)(total - sum);
  if (trees > MAX)
    MAX = trees, maxs.clear(),
    maxs.push_back(tmpmep[make_pair(min(p, first), max(p, first))]);
  else if (trees == MAX)
    maxs.push_back(tmpmep[make_pair(min(p, first), max(p, first))]);
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, k, n;
  scanf("%d", &n);
  for (int _ = 1; _ < n; _++) {
    scanf("%d%d%d", &i, &j, &k);
    mep[make_pair(min(i, j), max(i, j))] = _;
    edges[k].push_back(make_pair(min(i, j), max(i, j)));
    weight[_] = k;
  }
  for (i = 0; i <= n; i++) parent[i] = i, compsize[i] = 1;
  for (auto elm : edges) {
    set<int> nodes;
    tmpmep.clear();
    for (auto e : elm.second) {
      int first = f(e.first), second = f(e.second);
      nodes.insert(first);
      nodes.insert(second);
      A[first].push_back(second);
      A[second].push_back(first);
      tmpmep[make_pair(min(first, second), max(first, second))] = mep[e];
    }
    vector<pair<int, int> > roots;
    for (auto first : nodes)
      if (!visited[first]) roots.push_back(make_pair(first, dfs1(first)));
    for (auto first : nodes) visited[first] = false;
    for (auto p : roots) dfs2(p.first, -1, p.second);
    for (auto e : elm.second) add(e.first, e.second);
    for (auto first : nodes) {
      A[first].clear();
      visited[first] = false;
    }
  }
  sort((maxs).begin(), (maxs).end());
  printf("%lld %d\n", 2 * MAX, (int)maxs.size());
  for (auto m : maxs) printf("%d ", m);
  printf("\n");
  return 0;
}
