#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 5;
typedef struct disjointSet {
  int fa[MAXN + 20];
  int rnk[MAXN + 20];
  void clear(int N) {
    for (int i = 0; i <= N; i++) fa[i] = i, rnk[i] = 1;
  }
  disjointSet() {}
  disjointSet(int N) { clear(N); }
  int getRnk(int x) { return rnk[find(x)]; }
  int find(int x) {
    if (fa[x] == x) return x;
    return fa[x] = find(fa[x]);
  }
  void unite(int x, int y) {
    x = find(x), y = find(y);
    if (x != y) {
      fa[x] = y;
      rnk[y] += rnk[x];
    }
  }
} CDSU, *pCDSU;
struct Edge {
  int u, v, w, id;
  bool operator<(const Edge& rhs) const;
  int getDepth() const;
};
ostream& operator<<(ostream& _out, const Edge& e) {
  _out << "(" << e.u << "," << e.v << "," << e.w << ")";
  return _out;
}
long long sum[MAXN];
CDSU DSU;
int N, depth[MAXN], tsum[MAXN];
vector<Edge> edge;
vector<int> G[MAXN], ans;
int Edge::getDepth() const { return depth[u]; }
bool Edge::operator<(const Edge& rhs) const {
  if (w != rhs.w) return w < rhs.w;
  return getDepth() > rhs.getDepth();
}
void DFS(int cu, int fa = 0, int dp = 0) {
  depth[cu] = dp;
  for (int to : G[cu])
    if (to != fa) DFS(to, cu, dp + 1);
}
void AddEdge(int u, int v) {
  G[u].push_back(v);
  G[v].push_back(u);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long ansnum = 0;
  int u, v, w;
  cin >> N;
  DSU.clear(N + 1);
  for (int i = 0; i < N - 1; i++) {
    cin >> u >> v >> w;
    edge.push_back(Edge{u, v, w, i});
    AddEdge(u, v);
  }
  DFS(1);
  ;
  for (vector<Edge>::iterator itr = edge.begin(); itr != edge.end(); itr++)
    if (depth[itr->u] < depth[itr->v]) swap(itr->u, itr->v);
  sort(edge.begin(), edge.end());
  ;
  for (int i = 0, k = i; i < N - 1; i = k) {
    int j;
    for (j = i; j < N - 1 && edge[j].w == edge[i].w; j++) {
      ;
      ;
      tsum[j] = DSU.getRnk(edge[j].u);
      ;
      DSU.unite(edge[j].u, edge[j].v);
    }
    for (k = i; k < j; k++)
      sum[edge[k].id] += 2LL * tsum[k] * (DSU.getRnk(edge[k].u) - tsum[k]);
  };
  ans.clear();
  for (int i = 0; i < N - 1; i++) {
    if (ansnum < sum[i]) {
      ansnum = sum[i];
      ans = {i + 1};
    } else if (ansnum == sum[i])
      ans.push_back(i + 1);
  }
  cout << ansnum << " " << ans.size() << endl;
  copy(ans.begin(), ans.end(), ostream_iterator<int>(cout, " "));
  cout << endl;
}
