#include <bits/stdc++.h>
using namespace std;
int n;
struct st {
  int x, y;
  int d;
  int id;
};
vector<st> e;
const int mxn = (1e5) + 5;
int p[mxn];
int p1[mxn];
int sz[mxn];
int sz1[mxn];
int c[mxn];
vector<pair<int, int> > g[mxn];
int find(int x) {
  if (p[x] == x) return x;
  return find(p[x]);
}
void merge(int x, int y) {
  x = find(x);
  y = find(y);
  if (sz[x] > sz[y]) {
    merge(y, x);
    return;
  }
  sz[y] += sz[x];
  sz[x] = 0;
  p[x] = y;
}
int find1(int x) {
  if (p1[x] == x) return x;
  return find1(p1[x]);
}
void merge1(int x, int y) {
  x = find1(x);
  y = find1(y);
  if (sz1[x] > sz1[y]) {
    merge1(y, x);
    return;
  }
  sz1[y] += sz1[x];
  sz1[x] = 0;
  p1[x] = y;
}
bool cmp(st x, st y) { return x.d < y.d; }
bool cmp1(st x, st y) {
  return min(c[find(x.x)], c[find(x.y)]) < min(c[find(y.x)], c[find(y.y)]);
}
long long ans;
vector<int> v;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; ++i) {
    int x, y, d;
    scanf("%d%d%d", &x, &y, &d);
    st tmp;
    tmp.x = x;
    tmp.y = y;
    tmp.d = d;
    tmp.id = i;
    e.push_back(tmp);
  }
  for (int i = 1; i <= n; ++i) p[i] = p1[i] = i, sz[i] = sz1[i] = 1;
  sort(e.begin(), e.end(), cmp);
  queue<st> s;
  for (int i = 0; i < n - 1; ++i) {
    int j = i;
    for (j; j < n - 1 && e[j].d == e[i].d; ++j) {
      int xx = find(e[j].x);
      int yy = find(e[j].y);
      ++c[xx];
      ++c[yy];
      merge1(e[j].x, e[j].y);
      e[j].x = xx;
      e[j].y = yy;
      g[xx].push_back(make_pair(yy, e[j].id));
      g[yy].push_back(make_pair(xx, e[j].id));
    }
    --j;
    for (int k = i; k <= j; ++k) {
      int xx = e[k].x;
      int yy = e[k].y;
      st tmp = e[k];
      if (c[yy] == 1) {
        int z = tmp.x;
        tmp.x = tmp.y;
        tmp.y = z;
      }
      if (min(c[xx], c[yy]) == 1) {
        s.push(tmp);
        --c[xx];
        --c[yy];
      }
    }
    while (!s.empty()) {
      int xx = find(s.front().x);
      int yy = find(s.front().y);
      if (xx == yy) {
        s.pop();
        continue;
      }
      long long vl;
      if (c[s.front().x] <= c[s.front().y])
        vl = 1LL * sz[xx] * (sz1[find1(xx)] - sz[xx]);
      else
        vl = 1LL * sz[yy] * (sz1[find1(yy)] - sz[yy]);
      if (vl == ans) v.push_back(s.front().id);
      if (vl > ans) {
        ans = vl;
        v.clear();
        v.push_back(s.front().id);
      }
      merge(xx, yy);
      xx = s.front().x;
      yy = s.front().y;
      if (c[xx] == 0) g[xx].clear();
      if (c[yy] == 0) g[yy].clear();
      if (c[xx] == 1) {
        for (int k = 0; k < g[xx].size(); ++k) {
          int u = g[xx][k].first;
          int id = g[xx][k].second;
          if (c[u]) {
            --c[u];
            --c[xx];
            st tmp;
            tmp.x = xx;
            tmp.y = u;
            tmp.id = id;
            s.push(tmp);
          }
        }
      }
      if (c[yy] == 1) {
        for (int k = 0; k < g[yy].size(); ++k) {
          int u = g[yy][k].first;
          int id = g[yy][k].second;
          if (c[u]) {
            --c[u];
            --c[yy];
            st tmp;
            tmp.x = yy;
            tmp.y = u;
            tmp.id = id;
            s.push(tmp);
          }
        }
      }
      s.pop();
    }
    i = j;
  }
  printf("%I64d %d\n", ans * 2, v.size());
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); ++i) printf("%d ", v[i]);
  printf("\n");
  return 0;
}
