// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define MAXN 100000
#define MAXR 100000
#define MAXP 100000
#define MAXQ 100000

int       N, P, Q, R, i;
int       U[MAXN - 1], V[MAXN - 1], W[MAXN - 1];
int       A[MAXP];
int       B[MAXQ];
int       C[MAXR];
long long ans[MAXN];

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(1 == scanf("%d", &N));

    for (i = 0; i < N - 1; ++i)
        assert(3 == scanf("%d%d%d", &U[i], &V[i], &W[i]));

    assert(1 == scanf("%d", &P));

    for (i = 0; i < P; ++i)
        assert(1 == scanf("%d", &A[i]));

    assert(1 == scanf("%d", &Q));

    for (i = 0; i < Q; ++i)
        assert(1 == scanf("%d", &B[i]));

    assert(1 == scanf("%d", &R));

    for (i = 0; i < R; ++i)
        assert(1 == scanf("%d", &C[i]));



    // INSERT YOUR CODE HERE


    for (i = 0; i < N; ++i)
        printf("%lld ", ans[i]);
    printf("\n");

    return 0;
}
