#include <bits/stdc++.h>
using namespace std;
long long int subtree[100001];
long long int wt[100001];
int p[100001];
int rank1[100001];
int find_root(int idx) {
  while (p[idx] != -1) {
    idx = p[idx];
  }
  return idx;
}
void merge(int ind1, int ind2) {
  int a = find_root(ind1);
  int b = find_root(ind2);
  if (a == b) return;
  if (rank1[a] > rank1[b]) {
    p[b] = a;
    wt[a] += wt[b];
  } else {
    p[a] = b;
    wt[b] += wt[a];
  }
  if (rank1[a] == rank1[b]) {
    rank1[b]++;
  }
}
int vis[100001];
typedef struct edge {
  int x;
  int y;
  long long int w;
  int id;
} edge;
vector<int> ver;
vector<int> adj[100001];
vector<int> id[100001];
vector<edge> edges;
int compare(const edge &a, const edge &b) { return a.w < b.w; }
long long int ans[100001];
vector<int> total;
long long int val = 0;
long long int dfs(int idx) {
  subtree[idx] = wt[idx];
  vis[idx] = 1;
  total.push_back(idx);
  for (int i = 0; i < adj[idx].size(); i++) {
    if (!vis[adj[idx][i]]) {
      subtree[idx] = subtree[idx] + dfs(adj[idx][i]);
    }
  }
  val = val + wt[idx];
  return subtree[idx];
}
void compute(int idx) {
  vis[idx] = 1;
  for (int i = 0; i < adj[idx].size(); i++) {
    if (!vis[adj[idx][i]]) {
      ans[id[idx][i]] =
          2 * (val - subtree[adj[idx][i]]) * (subtree[adj[idx][i]]);
      compute(adj[idx][i]);
    }
  }
}
int main() {
  memset(subtree, 0, sizeof subtree);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    p[i] = -1;
    wt[i] = 1;
    rank1[i] = 0;
  }
  int x, y, w;
  edge e;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d", &x);
    scanf("%d", &y);
    scanf("%d", &w);
    x--;
    y--;
    e.x = x;
    e.y = y;
    e.w = w;
    e.id = i;
    edges.push_back(e);
  }
  sort(edges.begin(), edges.end(), compare);
  int pos = 0;
  int pos1;
  while (1) {
    if (pos == edges.size()) break;
    int flag = 0;
    for (int i = pos; i < edges.size(); i++) {
      if (edges[i].w != edges[pos].w) {
        flag = 1;
        pos1 = i;
        break;
      }
    }
    if (flag == 0) {
      pos1 = edges.size();
    }
    for (int i = pos; i < pos1; i++) {
      x = edges[i].x;
      y = edges[i].y;
      ver.push_back(find_root(x));
      ver.push_back(find_root(y));
      x = find_root(x);
      y = find_root(y);
      adj[x].push_back(y);
      adj[y].push_back(x);
      id[x].push_back(edges[i].id);
      id[y].push_back(edges[i].id);
    }
    for (int i = 0; i < ver.size(); i++) {
      vis[ver[i]] = 0;
    }
    for (int i = 0; i < ver.size(); i++) {
      if (!vis[ver[i]]) {
        val = 0;
        dfs(ver[i]);
        for (int j = 0; j < total.size(); j++) {
          vis[total[j]] = 0;
        }
        compute(ver[i]);
        total.clear();
      }
    }
    for (int i = 0; i < ver.size(); i++) {
      for (int j = 0; j < adj[ver[i]].size(); j++) {
        merge(ver[i], adj[ver[i]][j]);
      }
      adj[ver[i]].clear();
      id[ver[i]].clear();
    }
    ver.clear();
    pos = pos1;
  }
  long long int max1 = 0;
  vector<int> ed;
  for (int i = 0; i < n - 1; i++) {
    if (ans[i] > max1) {
      max1 = ans[i];
      ed.clear();
      ed.push_back(i + 1);
    } else if (ans[i] == max1) {
      ed.push_back(i + 1);
    }
  }
  printf("%lld %d\n", max1, (int)ed.size());
  for (int i = 0; i < ed.size(); i++) {
    printf("%d ", ed[i]);
  }
  printf("\n");
}
