#include <bits/stdc++.h>
using namespace std;
int parent[100010], size[100010];
int find(int v) {
  while (parent[v] != v) v = parent[v];
  return v;
}
void unions(int a, int b) {
  if (size[a] < size[b]) {
    parent[a] = b;
    size[b] += size[a];
  } else {
    parent[b] = a;
    size[a] += size[b];
  }
}
vector<pair<long long, int> > vp, ans;
int A[100010], B[100010];
vector<int> G[100010];
vector<int> edge[100010];
int subtree[100010];
set<int>::iterator it;
bool visited[100010];
int curr_total = 0;
void gettotalcount(int node) {
  visited[node] = true;
  for (int i = 0; i < G[node].size(); i++) {
    int v = G[node][i];
    if (!visited[v]) gettotalcount(v);
  }
  curr_total += size[node];
  visited[node] = false;
}
void dfs(int node, int no) {
  visited[node] = true;
  subtree[node] = 0;
  for (int i = 0; i < G[node].size(); i++) {
    int v = G[node][i];
    int idx = edge[node][i];
    if (!visited[v]) {
      dfs(v, idx);
      subtree[node] += subtree[v];
    }
  }
  subtree[node] += size[node];
  if (no != -1)
    ans.push_back(pair<long long, int>(
        subtree[node] * 1LL * (curr_total - subtree[node]), no));
}
inline void solve_each(int st, int en) {
  set<int> concerned;
  concerned.clear();
  for (int i = st; i <= en; i++) {
    int idx = vp[i].second;
    int a = find(A[idx]), b = find(B[idx]);
    concerned.insert(a);
    concerned.insert(b);
    G[a].push_back(b);
    edge[a].push_back(idx);
    G[b].push_back(a);
    edge[b].push_back(idx);
  }
  for (it = concerned.begin(); it != concerned.end(); it++) {
    int v = *it;
    if (!visited[v]) {
      curr_total = 0;
      gettotalcount(v);
      dfs(v, -1);
    }
  }
  for (it = concerned.begin(); it != concerned.end(); it++) {
    visited[*it] = false;
    G[*it].clear();
    edge[*it].clear();
  }
  for (int i = st; i <= en; i++) {
    int idx = vp[i].second;
    int a = find(A[idx]), b = find(B[idx]);
    unions(a, b);
  }
}
int N;
inline void ReadInput(void) {
  scanf("%d", &N);
  for (int i = 1; i < N; i++) {
    scanf("%d", &A[i]);
    scanf("%d", &B[i]);
    int c;
    scanf("%d", &c);
    vp.push_back(pair<long long, int>(c, i));
  }
}
inline void solve(void) {
  fill(visited, visited + 100010, false);
  for (int i = 1; i <= N; i++) {
    size[i] = 1;
    parent[i] = i;
  }
  sort(vp.begin(), vp.end());
  for (int i = 0; i < vp.size(); i++) {
    int j;
    for (j = i + 1; j < vp.size(); j++) {
      if (vp[j].first != vp[i].first) break;
    }
    j--;
    solve_each(i, j);
    i = j;
  }
  sort(ans.begin(), ans.end());
  long long cnt = 0, val = 0;
  val = ans[ans.size() - 1].first;
  for (int i = N - 2; i >= 0; i--) {
    if (ans[i].first == val) cnt++;
  }
  cout << val * 2 << " " << cnt << endl;
  for (int i = 0; i < ans.size(); i++) {
    if (ans[i].first == val) cout << ans[i].second << " ";
  }
  cout << endl;
}
inline void Refresh(void) {}
int main() {
  ReadInput();
  solve();
  return 0;
}
