#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 50;
int adj[N], nxt[N], to[N], len[N], ecnt;
int dis[N];
inline void addEdge(int f, int t, int l)
{
    ecnt++;
    nxt[ecnt] = adj[f];
    adj[f] = ecnt;
    to[ecnt] = t;
    len[ecnt] = l;
}
void dijkstra(int S)
{
    static int que[N];
    int l = 0;
    for (dis[que[l++] = S] = 0; l; pop_heap(que, que + l--))
    {
    }
}
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1, p, q, d; i < n; i++)
        scanf("%d%d%d", &p, &q, &d), addEdge(p, q, d), addEdge(q, p, d);
    for (int i = 1; i <= n; i++)
    {
    }
    return 0;
}
