#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int next;
  int dist;
  int from;
  int num;
  long long ans;
  Edge(int first, int ver, int d, int ind) {
    from = first;
    next = ver;
    dist = d;
    num = ind;
    ans = 0;
  }
};
struct Edge2 {
  int next;
  int ans;
  int num;
  Edge2(int Next, int Ind) {
    next = Next;
    num = Ind;
    ans = -1;
  }
};
struct Less {
  bool operator()(const Edge &(a), const Edge &(b)) { return a.dist < b.dist; }
  bool operator()(const pair<long long, int> &a,
                  const pair<long long, int> &b) {
    if (a.first == b.first) return a.second < b.second;
    return a.first > b.first;
  }
};
struct SNM {
  vector<int> a;
  vector<int> power;
  SNM(int n = 0) {
    a = vector<int>(n);
    power = vector<int>(n, 1);
    for (int i = 0; i < n; ++i) a[i] = i;
  }
  int p(int x) {
    if (a[x] == x) return x;
    a[x] = p(a[x]);
    return a[x];
  }
  int Power(int x) { return power[p(x)]; }
  void Union(int x, int y) {
    int p1 = p(x);
    int p2 = p(y);
    if (rand() & 1) {
      a[p1] = p2;
      power[p2] += power[p1];
    } else {
      a[p2] = p1;
      power[p1] += power[p2];
    }
  }
  int operator[](const int &i) { return p(i); }
};
vector<bool> was;
vector<Edge> a;
vector<vector<Edge2> > g;
vector<int> edgePower;
SNM b;
void dfs(int x, vector<int> &dist) {
  if (was[x]) return;
  was[x] = true;
  dist[x] = b.Power(x);
  for (int i = 0; i < g[x].size(); ++i) {
    if (!was[g[x][i].next]) {
      dfs(g[x][i].next, dist);
      dist[x] += dist[g[x][i].next];
      g[x][i].ans = dist[g[x][i].next];
      edgePower[g[x][i].num] = dist[g[x][i].next];
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    int l, r, d;
    cin >> l >> r >> d;
    --l;
    --r;
    a.push_back(Edge(l, r, d, i));
  }
  b = SNM(n);
  g = vector<vector<Edge2> >(n);
  edgePower = vector<int>(n - 1);
  sort(a.begin(), a.end(), Less());
  set<pair<long long, int>, Less> ans;
  vector<int> dist(n);
  int i = 0;
  was = vector<bool>(n);
  while (i < n - 1) {
    vector<Edge> c;
    while (c.size() == 0 || a[i].dist == a[i - 1].dist) {
      c.push_back(a[i++]);
    }
    for (int i = 0; i < c.size(); ++i) {
      was[b[c[i].from]] = false;
      was[b[c[i].next]] = false;
      g[b[c[i].from]] = vector<Edge2>();
      g[b[c[i].next]] = vector<Edge2>();
    }
    for (int i = 0; i < c.size(); ++i) {
      g[b[c[i].from]].push_back(Edge2(b[c[i].next], c[i].num));
      g[b[c[i].next]].push_back(Edge2(b[c[i].from], c[i].num));
    }
    for (int i = 0; i < c.size(); ++i) {
      dfs(b[c[i].from], dist);
      dfs(b[c[i].next], dist);
    }
    for (int i = 0; i < c.size(); ++i) {
      b.Union(c[i].from, c[i].next);
    }
    for (int i = 0; i < c.size(); ++i) {
      long long first = edgePower[c[i].num];
      long long second = b.Power(c[i].from) - first;
      ans.insert(pair<long long, int>(2 * first * second, c[i].num + 1));
    }
  }
  int cnt = 0;
  for (set<pair<long long, int> >::iterator it = ans.begin();
       it != ans.end() && it->first == ans.begin()->first; ++it) {
    ++cnt;
  }
  cout << ans.begin()->first << ' ' << cnt << '\n';
  for (set<pair<long long, int> >::iterator it = ans.begin();
       it != ans.end() && it->first == ans.begin()->first; ++it) {
    cout << it->second << ' ';
  }
  return 0;
}
