#include <bits/stdc++.h>
using namespace std;
static const int N = 100001;
int o[N], d[N], num[N];
int findHead(int x) {
  int h = x;
  while (o[h] != h) h = o[h];
  int p;
  while (x != h) {
    p = x;
    x = o[x];
    o[p] = h;
  }
  return h;
}
void mergeSets(int x, int y) {
  x = findHead(x);
  y = findHead(y);
  if (d[x] < d[y]) swap(x, y);
  num[x] += num[y];
  o[y] = x;
  if (d[y] == d[x]) d[x]++;
}
struct edge {
  int x, y;
  int d, rb;
};
struct cmp {
  bool operator()(edge a, edge b) { return (a.d > b.d); }
};
priority_queue<edge, deque<edge>, cmp> heap;
long long sol[N];
struct node {
  int data;
  int rb;
  node *next;
  node() { next = NULL; }
};
node *niz[N];
int stp[N];
void connect(int x, int y, int rb) {
  node *tmp = new node;
  tmp->data = y;
  tmp->rb = rb;
  tmp->next = niz[x];
  niz[x] = tmp;
  stp[x]++;
}
int ec[N];
int dc[N];
int sum[N];
int cur;
int gp[N];
int S[N];
int cur2;
int done[N];
int pred[N];
void create(int x) {
  if (!dc[x]) {
    ec[cur] = x;
    dc[x] = cur;
    sum[cur] = num[x];
    cur++;
  }
}
queue<int> dred;
void dfs(int c) {
  if (stp[c] == 1) dred.push(c);
  gp[c] = cur2;
  S[cur2] += sum[c];
  node *tmp = niz[c];
  while (tmp) {
    if (!gp[tmp->data]) dfs(tmp->data);
    tmp = tmp->next;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    num[i] = 1;
    o[i] = i;
  }
  edge g;
  for (int i = 1; i < n; i++) {
    cin >> g.x;
    cin >> g.y;
    cin >> g.d;
    g.rb = i;
    heap.push(g);
  }
  while (!heap.empty()) {
    cur = 1;
    cur2 = 1;
    int val = heap.top().d;
    while (!heap.empty() && heap.top().d == val) {
      g = heap.top();
      heap.pop();
      int x = findHead(g.x);
      int y = findHead(g.y);
      create(x);
      create(y);
      x = dc[x];
      y = dc[y];
      connect(x, y, g.rb);
      connect(y, x, g.rb);
    }
    for (int i = 1; i < cur; i++)
      if (!gp[i]) {
        pred[cur2] = i;
        dfs(i);
        cur2++;
      }
    while (!dred.empty()) {
      int c = dred.front();
      dred.pop();
      done[c] = 1;
      if (stp[c] == 1) {
        long long pom = sum[c] * 2;
        pom *= S[gp[c]] - sum[c];
        node *tmp = niz[c];
        while (tmp) {
          if (!done[tmp->data]) {
            sol[tmp->rb] = pom;
            sum[tmp->data] += sum[c];
            stp[tmp->data]--;
            if (stp[tmp->data] == 1) dred.push(tmp->data);
          }
          tmp = tmp->next;
        }
      }
    }
    for (int i = 1; i < cur; i++)
      if (i != pred[gp[i]]) mergeSets(ec[pred[gp[i]]], ec[i]);
    for (int i = 0; i < cur; i++) {
      node *tmp;
      while (niz[i]) {
        tmp = niz[i];
        niz[i] = niz[i]->next;
        free(tmp);
      }
      stp[i] = 0;
      sum[i] = 0;
      done[i] = 0;
      dc[ec[i]] = 0;
      gp[i] = 0;
      S[i] = 0;
    }
  }
  long long high = 0;
  for (int i = 1; i < n; i++)
    if (sol[i] > high) high = sol[i];
  priority_queue<int> heap2;
  int br = 0;
  for (int i = 1; i < n; i++)
    if (sol[i] == high) {
      br++;
      heap2.push(-i);
    }
  cout << high << " " << br << endl;
  while (!heap2.empty()) {
    printf("%i ", -heap2.top());
    heap2.pop();
  }
  return 0;
}
