#include <bits/stdc++.h>
using namespace std;
struct _ {
  _() { ios_base::sync_with_stdio(0); }
} _;
template <class A, class B>
ostream &operator<<(ostream &o, pair<A, B> t) {
  o << "(" << t.first << ", " << t.second << ")";
  return o;
}
template <class T>
string tostring(T first, int len = 0, char c = '0') {
  stringstream ss;
  ss << first;
  string r = ss.str();
  if (r.length() < len) r = string(len - r.length(), c) + r;
  return r;
}
template <class T>
void PV(T a, T b, int n = 0, int w = 0, string s = " ") {
  int c = 0;
  while (a != b) {
    cout << tostring(*a++, w, ' ');
    if (a != b && (n == 0 || ++c % n))
      cout << s;
    else
      cout << "\n";
    cout.flush();
  }
}
template <class T>
inline bool chmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
inline bool chmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
const long long linf = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 111111;
struct DSU {
  int par[N + 1], cnt[N + 1];
  DSU(int n = N) { init(n); }
  void init(int n) {
    for (int i = 0; i <= n; i++) {
      par[i] = i;
      cnt[i] = 1;
    }
  }
  int find(int first) {
    if (par[first] != first) par[first] = find(par[first]);
    return par[first];
  }
  bool merge(int first, int second) {
    first = find(first), second = find(second);
    if (first == second) return 0;
    if (cnt[first] < cnt[second]) swap(first, second);
    par[second] = first;
    cnt[first] += cnt[second];
    return 1;
  }
} dsu;
int n;
vector<int> g[N];
vector<pair<int, pair<int, int>>> E;
map<pair<int, int>, int> eID;
map<pair<int, int>, int> D;
long long ans[N];
int cnt[N];
int sb[N];
int tot;
void dfs(int u, int par) {
  sb[u] = cnt[u];
  for (int v : g[u]) {
    if (v == par) continue;
    dfs(v, u);
    sb[u] += sb[v];
    long long first = (long long)sb[v] * (tot - sb[v]);
    if (u < v) {
      ans[D[make_pair(u, v)]] += first;
    } else {
      ans[D[make_pair(v, u)]] += first;
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int a, b, d;
    cin >> a >> b >> d;
    E.push_back(make_pair(d, make_pair(a, b)));
    eID[make_pair(a, b)] = i;
    eID[make_pair(b, a)] = i;
  }
  dsu.init(n);
  sort((E).begin(), (E).end());
  vector<pair<int, pair<int, int>>> e;
  vector<pair<int, int>> e1;
  int i = 0;
  while (i < E.size()) {
    e.clear();
    e1.clear();
    while (1) {
      e.push_back(E[i]);
      i++;
      if (i == E.size() || E[i].first != E[i - 1].first) break;
    }
    vector<int> vlist;
    D.clear();
    for (auto t : e) {
      int w = t.first, u = t.second.first, v = t.second.second;
      int first = dsu.find(u);
      int second = dsu.find(v);
      cnt[first] = dsu.cnt[first];
      cnt[second] = dsu.cnt[second];
      vlist.push_back(first);
      vlist.push_back(second);
      e1.push_back(make_pair(first, second));
      if (first > second) {
        D[make_pair(second, first)] = eID[t.second];
      } else {
        D[make_pair(first, second)] = eID[t.second];
      }
    }
    for (auto t : e)
      assert(dsu.merge(dsu.find(t.second.first), dsu.find(t.second.second)));
    for (auto t : e1) {
      g[t.first].clear();
      g[t.second].clear();
    }
    for (auto t : e1) {
      g[t.first].push_back(t.second);
      g[t.second].push_back(t.first);
    }
    sort((vlist).begin(), (vlist).end()),
        vlist.resize(unique((vlist).begin(), (vlist).end()) - vlist.begin());
    for (int root : vlist) {
      if (root != dsu.find(root)) continue;
      tot = dsu.cnt[root];
      dfs(root, -1);
      assert(tot == sb[root]);
    }
  }
  long long mx = *max_element(ans, ans + n);
  vector<int> res;
  for (int i = 1; i < n; i++)
    if (ans[i] == mx) res.push_back(i);
  sort((res).begin(), (res).end());
  cout << 2 * mx << " " << res.size() << endl;
  for (int i : res) cout << i << " ";
  cout << endl;
  return 0;
}
