#include <bits/stdc++.h>   using namespace std;   struct Edge {     int u, v, d, id;     long long cnt;     bool operator<(const struct Edge& rhs) const { return d < rhs.d; }   } edg[100001];   int vert[100001];   long long sz[100001];   int find(int i) {     if (vert[i] == i) return i;     return vert[i] = find(vert[i]);   }   void Union(int x, int y) {     int xset = find(x);     int yset = find(y);     if (xset != yset) {       vert[xset] = yset;       long long total = sz[xset] + sz[yset];       sz[xset] = sz[yset] = total;     }   }   int n;   int tmp_id[100001];   vector<pair<int, int> > gr[100001];   long long total_size[100001];   bool vis[100001];   long long ans[100001];   long long dfs_cnt(int cur, int id) {     vis[cur] = true;     tmp_id[cur] = id;     long long res = sz[cur];     for (int i = 0; i < gr[cur].size(); i++) {       int nxt = gr[cur][i].first;       if (vis[nxt]) continue;       res += dfs_cnt(nxt, id);     }     return res;   }   long long dfs(int cur) {     vis[cur] = true;     long long res = sz[cur];     for (int i = 0; i < gr[cur].size(); i++) {       int nxt = gr[cur][i].first, edg_id = gr[cur][i].second;       if (vis[nxt]) continue;       long long sub_size = dfs(nxt);       ans[edg_id] += sub_size * (total_size[tmp_id[cur]] - sub_size) * 2;       res += sub_size;     }     return res;   }   int main(void) {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 0; i < n - 1; i++) {       int u, v, d;       cin >> u >> v >> d;       struct Edge tmp = {u, v, d, i + 1, 0};       edg[i] = tmp;     }     for (int i = 1; i <= n; i++) {       vert[i] = i;       sz[i] = 1;     }     sort(edg, edg + n - 1);     int st = 0;     for (int i = 0; i < n - 1; i++) {       if (i == n - 1 || edg[i + 1].d != edg[i].d) {         vector<int> cln;         cln.clear();         for (int j = st; j <= i; j++) {           int u = edg[j].u, v = edg[j].v, id = edg[j].id;           int cmp1 = find(u), cmp2 = find(v);           vis[cmp1] = false;           vis[cmp2] = false;           gr[cmp1].push_back(make_pair(cmp2, id));           gr[cmp2].push_back(make_pair(cmp1, id));           cln.push_back(cmp1);           cln.push_back(cmp2);         }         int id = 0;         for (int j = 0; j < cln.size(); j++) {           if (vis[cln[j]]) continue;           total_size[id] = dfs_cnt(cln[j], id);           id++;         }         for (int j = 0; j < cln.size(); j++) {           vis[cln[j]] = false;         }         for (int j = 0; j < cln.size(); j++) {           if (vis[cln[j]]) continue;           dfs(cln[j]);         }         for (int j = 0; j < cln.size(); j++) {           vis[cln[j]] = false;           gr[cln[j]].clear();         }         for (int j = st; j <= i; j++) {           int u = edg[j].u, v = edg[j].v;           int cmp1 = find(u), cmp2 = find(v);           Union(cmp1, cmp2);         }         st = i + 1;       }     }     long long mx = -1;     for (int i = 1; i <= n - 1; i++) {       mx = max(mx, ans[i]);     }     vector<int> buff;     for (int i = 1; i <= n - 1; i++) {       if (ans[i] == mx) buff.push_back(i);     }     cout << mx <<     << buff.size() << endl;     for (int i = 0; i < buff.size(); i++) {       cout << buff[i] <<    ;     }     cout << endl;   }