#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const long double eps = 1e-8;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 100;
const int N = 1e5 + 100;
const int M = (1 << 20) + 10;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= c == '-';
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  x = f ? -x : x;
}
template <class T>
inline void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  T y = 1;
  int len = 1;
  for (; y <= x / 10; y *= 10) ++len;
  for (; len; --len, x %= y, y /= 10) putchar(x / y + 48);
}
long long qpow(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % mod;
    b >>= 1;
    a = (a * a) % mod;
  }
  return ans;
}
struct node {
  int eu, ev, w, id;
  bool operator<(const node &b) const { return w < b.w; }
};
vector<node> edges;
int cnt;
long long mx, ans[N];
int p[N], sz[N];
int Find(int x) { return x == p[x] ? x : p[x] = Find(p[x]); }
void Merge(int u, int v) {
  u = Find(u);
  v = Find(v);
  sz[u] += sz[v];
  p[v] = u;
}
vector<int> g[N];
int val[N], dp[N], rt[N];
vector<int> vec;
void dfs(int u, int fa, int root) {
  if (root == -1) root = u;
  dp[u] = sz[u];
  rt[u] = root;
  for (int v : g[u]) {
    if (v == fa) continue;
    dfs(v, u, root);
    dp[u] += dp[v];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) p[i] = i, sz[i] = 1;
  for (int i = 1; i < n; ++i) {
    node tmp;
    cin >> tmp.eu >> tmp.ev >> tmp.w;
    tmp.id = i;
    edges.push_back(tmp);
  }
  sort(edges.begin(), edges.end());
  for (int i = 0; i < n - 1; ++i) {
    vector<node> tt;
    tt.push_back(edges[i]);
    while (i + 1 < n - 1 && edges[i].w == edges[i + 1].w)
      tt.push_back(edges[++i]);
    for (auto &tmp : tt) {
      int u = tmp.eu, v = tmp.ev;
      u = Find(u), v = Find(v);
      vec.push_back(u), vec.push_back(v);
      g[u].push_back(v), g[v].push_back(u);
    }
    for (auto v : vec)
      if (!dp[v]) dfs(v, -1, -1);
    for (auto &tmp : tt) {
      int u = tmp.eu, v = tmp.ev, id = tmp.id;
      u = Find(u), v = Find(v);
      if (dp[v] > dp[u]) swap(u, v);
      ans[id] = 1ll * dp[v] * (dp[rt[v]] - dp[v]);
      if (ans[id] > mx) {
        mx = ans[id];
        cnt = 1;
      } else if (ans[id] == mx)
        cnt++;
    }
    for (auto &tmp : tt) Merge(tmp.eu, tmp.ev);
    for (auto v : vec) {
      g[v].clear();
      dp[v] = 0;
    }
    vec.clear();
  }
  cout << mx * 2 << " " << cnt << "\n";
  for (int i = 1; i <= n; ++i)
    if (ans[i] == mx) cout << i << " ";
  return 0;
}
