#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 10;
vector<pair<int, int> > adj[MAX_N];
pair<pair<int, int>, pair<int, int> > e[MAX_N];
int par[MAX_N], size_par[MAX_N];
long long tree[MAX_N];
bool mark[MAX_N];
int get_par(int u) { return par[u] = (par[u] == u ? u : get_par(par[u])); }
void merge(int u, int v) {
  u = get_par(u), v = get_par(v);
  par[u] = v;
  size_par[v] += size_par[u];
}
void dfs(int u, int v) {
  mark[u] = true;
  for (auto i : adj[u])
    if (i.first != v) dfs(i.first, u);
  if (u != v) merge(u, v);
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) par[i] = i, size_par[i] = 1;
  for (int i = 0; i < n - 1; i++) {
    cin >> e[i].second.first >> e[i].second.second >> e[i].first.first;
    e[i].second.first--, e[i].second.second--, e[i].first.second = i;
  }
  vector<int> cur;
  sort(e, e + n - 1);
  for (int i = 0; i < n - 1; i++) {
    int u = get_par(e[i].second.first), v = get_par(e[i].second.second);
    int k = e[i].first.second;
    cur.push_back(u), cur.push_back(v);
    adj[u].push_back(make_pair(v, k));
    adj[v].push_back(make_pair(u, k));
    if (e[i].first.first != e[i + 1].first.first) {
      sort(cur.begin(), cur.end());
      cur.erase(unique(cur.begin(), cur.end()), cur.end());
      for (auto x : cur) {
        if (!mark[x]) dfs(x, x);
        mark[x] = false;
        for (auto j : adj[x]) {
          int y = j.first, w = min(size_par[x], size_par[y]);
          tree[j.second] = 2LL * w * (size_par[get_par(x)] - w);
        }
        adj[x].clear();
      }
      cur.clear();
    }
  }
  vector<int> ans = {0};
  for (int i = 1; i < n - 1; i++) {
    if (tree[i] == tree[ans.front()])
      ans.push_back(i);
    else if (tree[i] > tree[ans.front()])
      ans.clear(), ans.push_back(i);
  }
  cout << tree[ans.front()] << ' ' << ((int)(ans).size()) << endl;
  for (auto i : ans) cout << i + 1 << ' ';
  return 0;
}
