#include <bits/stdc++.h>
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : (-x);
}
template <class T>
T sqr(T x) {
  return x * x;
}
const int maxn = 218 * 1000;
vector<pair<int, int> > g[maxn];
vector<int> gind[maxn];
vector<int> v;
long long opt = -1;
vector<int> cnt;
vector<int> G[maxn];
vector<int> Gind[maxn];
int val[maxn];
int u[maxn];
int uc[maxn];
int get(int x) {
  if (x == u[x]) return x;
  return u[x] = get(u[x]);
}
void uni(int x, int y) {
  if (rand() % 2) swap(x, y);
  x = get(x), y = get(y);
  if (x == y) return;
  uc[y] += uc[x];
  u[x] = y;
}
long long sum = 0;
bool us[maxn];
void dfs0(int x, int p = -1) {
  us[x] = true;
  sum += val[x];
  for (int i = 0; i < ((int)(G[x]).size()); ++i) {
    if (G[x][i] == p) continue;
    dfs0(G[x][i], x);
  }
}
long long dfs(int x, int p = -1) {
  long long res = val[x];
  for (int i = 0; i < ((int)(G[x]).size()); ++i) {
    if (G[x][i] == p) continue;
    long long t = dfs(G[x][i], x);
    long long cur = t * (sum - t);
    if (cur > opt) {
      opt = cur;
      cnt.clear();
      cnt.push_back(Gind[x][i]);
    } else if (cur == opt)
      cnt.push_back(Gind[x][i]);
    res += t;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) u[i] = i, uc[i] = 1;
  vector<pair<pair<int, int>, pair<int, int> > > e;
  for (int i = 0; i < n - 1; ++i) {
    int x, y, z;
    scanf("%d%d%d", &x, &y, &z);
    --x, --y;
    g[x].push_back(pair<int, int>(y, z));
    g[y].push_back(pair<int, int>(x, z));
    gind[x].push_back(i);
    gind[y].push_back(i);
    v.push_back(z);
    e.push_back(make_pair(pair<int, int>(z, i), pair<int, int>(x, y)));
  }
  sort((v).begin(), (v).end());
  v.erase(unique((v).begin(), (v).end()), v.end());
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < ((int)(g[i]).size()); ++j) {
      int l = g[i][j].second;
      l = lower_bound((v).begin(), (v).end(), l) - v.begin();
      g[i][j].second = l;
    }
  sort((e).begin(), (e).end());
  int cur = 0;
  while (cur < ((int)(e).size())) {
    int next = cur;
    vector<int> w;
    while (next < ((int)(e).size()) &&
           e[next].first.first == e[cur].first.first) {
      w.push_back(get(e[next].second.first));
      w.push_back(get(e[next].second.second));
      ++next;
    }
    sort((w).begin(), (w).end());
    w.erase(unique((w).begin(), (w).end()), w.end());
    int m = ((int)(w).size());
    sum = 0;
    for (int i = 0; i < m; ++i) {
      G[i].clear();
      Gind[i].clear();
      val[i] = uc[w[i]];
      sum += val[i];
      us[i] = false;
    }
    for (int i = cur; i < next; ++i) {
      int x = lower_bound((w).begin(), (w).end(), get(e[i].second.first)) -
              w.begin();
      int y = lower_bound((w).begin(), (w).end(), get(e[i].second.second)) -
              w.begin();
      G[x].push_back(y);
      G[y].push_back(x);
      Gind[x].push_back(e[i].first.second);
      Gind[y].push_back(e[i].first.second);
    }
    for (int i = 0; i < m; ++i) {
      if (us[i]) continue;
      sum = 0;
      dfs0(i);
      dfs(i);
    }
    for (int i = cur; i < next; ++i) {
      uni(e[i].second.first, e[i].second.second);
    }
    cur = next;
  }
  sort((cnt).begin(), (cnt).end());
  cout << (2LL * opt) << " " << ((int)(cnt).size()) << "\n";
  for (int i = 0; i < ((int)(cnt).size()); ++i) printf("%d ", cnt[i] + 1);
  printf("\n");
  return 0;
}
