A long time ago in some country in Asia were civil wars.

Each of *n* cities wanted to seize power. That's why sometimes one city gathered an army and sent it to campaign against another city.

Road making was difficult, so the country had few roads, exactly *n* - 1. Also you could reach any city from any other city going on those roads.

Even during the war the Oriental people remain spiritually rich and appreciate the beauty of nature. And to keep the memory of this great crusade for the centuries to come, they planted one beautiful tree by the road on which the army spent most time. The Oriental people love nature, that's why if there were several such roads, then one tree was planted by each of them.

Recently, when the records of the war were found, it became clear that each city attacked each other one exactly once. There were exactly *n*(*n* - 1) attacks in total. Everyone has been wondering what road after those wars became the most beautiful, that is, by which road they planted the largest number of beautiful trees.
The first line contains an integer *n* (2 ≤ *n* ≤ 10<sup class="upper-index">5</sup>), which represents the number of cities. Next *n* - 1 lines contain three integers each: the numbers of cities *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> (1 ≤ *a*<sub class="lower-index">*i*</sub>, *b*<sub class="lower-index">*i*</sub> ≤ *n*), connected by the *i*-th road and the number of days *d*<sub class="lower-index">*i*</sub> the army spends to go on it (1 ≤ *d*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>). The lengths of several roads may coincide.
none
2
2 1 5
2 1
1 
6
1 2 1
1 3 5
3 4 2
3 5 3
3 6 4
16 1
2 
10
10 6 43981
4 2 6730
1 2 35174
5 3 61951
8 7 43981
7 1 6730
5 8 6730
9 3 52479
6 4 18138
32 1
4 
9
6 4 72697
9 6 72697
1 6 38220
2 6 38220
6 7 72697
6 5 72697
8 6 72697
3 6 38220
16 5
1 2 5 6 7 
10
9 2 18232
3 4 45701
3 9 13895
8 9 18232
7 6 56122
3 5 45701
7 1 56122
8 10 18232
2 7 91606
42 1
9 
7
1 2 7485
6 7 50574
3 1 50574
3 4 50574
5 6 58286
6 1 58286
24 1
6 
4
2 3 1914
4 1 31823
4 2 26249
6 1
2 
5
3 2 72460
3 4 69285
3 5 69285
1 3 11694
8 1
1 
9
5 9 29573
7 3 72031
8 5 72031
6 7 72031
9 7 27434
3 2 27434
4 7 76150
1 9 27434
24 1
2 
5
5 4 58958
2 1 37970
2 5 37970
1 3 37970
8 2
1 2 
10
6 5 30
2 5 30
7 8 81
5 4 46
9 10 30
5 7 30
10 2 46
8 3 46
1 10 46
32 1
3 
10
4 2 73
10 8 73
8 7 83
9 5 83
2 1 86
4 9 88
2 6 30
8 4 30
7 3 32
32 1
6 
10
9 4 75
2 7 29
1 8 19
9 5 20
4 1 19
2 4 19
10 3 29
2 3 20
6 4 29
32 1
1 
10
10 1 74
8 1 43
6 3 59
2 9 58
6 4 62
6 7 74
2 5 62
1 6 74
5 3 8
42 1
8 
17
6 16 69066
2 5 77345
7 17 49859
11 15 77345
14 2 96308
3 5 49859
10 13 16769
4 17 58915
15 1 99387
1 3 77937
6 8 53782
13 14 21754
9 4 49859
12 8 96308
11 9 96308
12 7 96288
140 1
9 
9
1 6 802882924
7 5 807576793
9 4 343794537
5 3 807576793
2 7 394413002
9 7 353519612
1 7 784711994
5 8 784711994
36 1
2 
from collections import deque
from operator import itemgetter


class DisjoinSet:
    def __init__(self, n):
        self.padre = [x for x in range(0, n)]
        self.cantidad_vertices = [1]*n

    def Padre(self, x):
        if x == self.padre[x]:
            return x
        self.padre[x] = self.Padre(self.padre[x])
        return self.padre[x]

    def Union(self, x, y):
        raiz_x = self.Padre(x)
        raiz_y = self.Padre(y)
        self.padre[raiz_y] = raiz_x
        self.cantidad_vertices[raiz_x] += self.cantidad_vertices[raiz_y]


def DFS(x, p, adyacentes, color, cantidad_vertices, posiciones, copia):
    color[x] = 1
    copia[p] = cantidad_vertices[x]
    for y, i in adyacentes[x]:
        if color[y] == 0:
            copia[p] += DFS(y, i, adyacentes, color,
                            cantidad_vertices, posiciones, copia)
    posiciones.append(p)
    return copia[p]


def Solucion():
    # recibiendo la entrada
    n = int(input())
    m = n-1
    edges = [-1]*m
    for i in range(0, m):
        x, y, d = map(int, input().split())
        edges[i] = (x-1, y-1,  i+1, d)

    # ordenar aristas por valor d y todas las aristas que tengan un mismo
    # d guardarlas juntas
    resultados = [0]*n
    edges.sort(key=itemgetter(3))
    current = edges[0][3]
    lista_de_d = deque()
    lista_de_aristas = deque()
    for x, y, i, d in edges:
        if current != d:
            lista_de_d.append(lista_de_aristas)
            lista_de_aristas = deque()
            current = d
        lista_de_aristas.append((x, y, i))
    lista_de_d.append(lista_de_aristas)

    DS = DisjoinSet(n)
    vertices_alcanzables = [0]*n

    for lista in lista_de_d:
        adyacentes = [[] for _ in range(0, n)]
        color = [0]*n
        x_d_i = deque()

        for x, y, i in lista:
            p_x = DS.Padre(x)
            p_y = DS.Padre(y)
            adyacentes[p_x].append((p_y, i))
            adyacentes[p_y].append((p_x, i))
            x_d_i.append((p_x, i))

        for x, _ in x_d_i:
            if color[x] == 0:
                posiciones = deque()
                total = DFS(x, 0,  adyacentes, color,
                            DS.cantidad_vertices, posiciones, vertices_alcanzables)

                for pos in posiciones:
                    resultados[pos] = (
                        total-vertices_alcanzables[pos])*vertices_alcanzables[pos]*2

        for x, y, i in lista:
            DS.Union(x, y)

    maximo = max(resultados[1:])
    aristas_maximas = []
    for p in range(1, n):
        if resultados[p] == maximo:
            aristas_maximas.append(p)
    cant_maximos = len(aristas_maximas)
    print(str(maximo)+' '+str(cant_maximos))
    print(*aristas_maximas, sep=" ")


Solucion()
