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

# se  va de tiempo viene siendo como la idea intuitiva de dividir en caso es el primer
# codigo que escribi el otro es mas organizado y analiza para todos y no dividiendo por casos


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]


# Dfs para saber el numero de aristas a la derecha de un vertice
def DFSsumando(x, cantidad_vertices, color, padre, ady, num, i, DS):
    color[x] = 1
    num[x] = i
    for y in ady[x]:
        if color[y] == 0:
            DFSsumando(y, cantidad_vertices, color, padre, ady, num, i, DS)
            DS.Union(x, y)
    color[x] = 2


def BeautifulRoad():
    n = int(input())
    m = n-1
    edges = [-1]*m
    adyacentes = [[] for _ in range(0, n)]

    # recibiendo las aristas
    for i in range(0, m):
        e = input().split()
        x = int(e[0])
        y = int(e[1])
        d = int(e[2])
        edges[i] = (x-1, y-1, d, i)
        adyacentes[x-1].append(y-1)
        adyacentes[y-1].append(x-1)
    edges.sort(key=itemgetter(2))
    resultado = [0]*m
    DS = DisjoinSet(n)

    # caso 1 en que todas las aristas tienen el mismo valor d
    inicio = edges[0]
    final = edges[n-2]
    if inicio[2] == final[2]:
        color = num = [0]*n

        for x, y, d, pos in edges:
            if color[x] == 0:
                DFSsumando(x, DS.cantidad_vertices, color,
                           DS.padre, adyacentes, num, 1, DS)

        for x, y, _, pos in edges:
            px = DS.padre[x]
            li = 0
            if px == y:
                li = DS.cantidad_vertices[x]
            else:
                li = DS.cantidad_vertices[y]

            res = li*(n-li)*2
            resultado[pos] = res

    # existen al menos dos aristas con d diferente
    else:
        i = 0
        while i < m:
            min = edges[i][2]
            k = i+1

            # si se repite un valor d
            if k < m and edges[k][2] == min:
                adyacentes_temp = [[] for _ in range(0, n)]
                edges_temp = deque()
                # ir agregando todas las aristas con peso min
                while True:
                    x, y, d, posI = edges[k-1]
                    r_a = DS.Padre(x)
                    r_b = DS.Padre(y)
                    edges_temp.append((r_a, r_b, posI))
                    adyacentes_temp[r_a].append(r_b)
                    adyacentes_temp[r_b].append(r_a)

                    if k >= m or edges[k][2] != min:
                        break
                    k += 1

                cant = []
                num_cc = [0]*n
                color = [0]*n
                contador = 1
                # por cada arista tempoar el dfs
                for x, y, i_inicio in edges_temp:
                    if color[x] == 0:
                        DFSsumando(x, DS.cantidad_vertices, color, DS.padre,
                                   adyacentes_temp, num_cc, contador, DS)
                        # una nueva cc
                        cant.append(DS.cantidad_vertices[x])
                        contador += 1

                # calculando el valor de cada arista
                for x, y, i_inicio in edges_temp:
                    px = DS.padre[x]
                    li = 0
                    if px == y:
                        li = DS.cantidad_vertices[x]
                    else:
                        li = DS.cantidad_vertices[y]

                    # cantidad de vertices en esa cc
                    h = num_cc[x]
                    res = li*(cant[h-1]-li)*2
                    resultado[i_inicio] = res

                # saltar las aristas q ya se analizaron
                i = k

            # si no ay varias aristas con ese valor d
            else:
                x, y,  _, i_inicio = edges[i]
                px = DS.Padre(x)
                py = DS.Padre(y)

                res = DS.cantidad_vertices[px]*DS.cantidad_vertices[py]*2
                resultado[i_inicio] = res

                DS.Union(px, py)
                i += 1

    # Calcular la cantidad mayor de arboles,carreteras mas hermosas y devolver cada una de estas carreteras hermosas
    maximo = max(resultado[1:])
    aristas_maximas = []
    for p in range(1, n):
        if resultado[p] == maximo:
            aristas_maximas.append(p)
    cant_maximos = len(aristas_maximas)
    print(str(maximo)+' '+str(cant_maximos))
    print(*aristas_maximas, sep=" ")


BeautifulRoad()
