Lightning Energy Report

No attempts yetTime limit1sMemory limit256 MB

Problem

The city of Thunder is a network of houses that run on lightning. Some pairs of houses are joined by wires, and the wires form a tree: between any two houses there is exactly one path. Every house has a battery that can hold an unlimited amount of energy, and at the start of the month every battery reads 00.

During the month, lightning strikes the city many times. Each strike is unusual: it hits two houses at the same instant — house AA with a red bolt and house BB with a blue bolt — and delivers CC units of energy to every house on the path from AA to BB (both endpoints included). That energy is added to each of those houses' batteries.

At the end of the month the mayor needs a report of the total energy stored in every house's battery. Produce that report from the month's observed strikes.

Input

The first line contains an integer TT (T10T \le 10) — the number of test cases. Each test case is given as follows.

  • A line with an integer NN (2N500002 \le N \le 50000), the number of houses, numbered 00 through N1N-1.
  • N1N-1 lines, each with two integers XX and YY (0X,YN10 \le X, Y \le N-1), meaning houses XX and YY are joined by a wire. These wires always form a tree.
  • A line with an integer QQ (1Q500001 \le Q \le 50000), the number of strikes.
  • QQ lines, each with three integers AA, BB, and CC (0A,BN10 \le A, B \le N-1, 1C1001 \le C \le 100): a strike that adds CC units of energy to every house on the path from house AA to house BB. AA and BB may be equal, in which case only that single house is charged.

Output

For each test case, first print a line Case #X:, where XX is the test case number starting from 11. Then print NN lines: the ii-th line (for i=0,1,,N1i = 0, 1, \ldots, N-1) is the total energy stored in the battery of house ii at the end of the month.