Miners

No attempts yetTime limit2sMemory limit128 MB

Problem

A wealthy country owes much of its riches to its own gold deposits. To raise output, the government has decided to permanently assign miners to specific tunnels.

Every mine in the country has the same structure. A mine has exactly one entrance and consists of chambers joined by tunnels. From the entrance there is exactly one route to each chamber (possibly passing through several tunnels and other chambers along the way), so a mine forms a tree.

Gold is extracted only in chambers that connect to exactly one other chamber. The entrance chamber, however, is never used for extraction, even when it connects to only one other chamber.

Tunnels have different heights. A miner loaded with equipment cannot stoop, so a miner can pass through a tunnel only if its height is at least the miner's own height. Hence a miner can reach a chamber only if every tunnel on the route from the entrance to that chamber is at least as tall as the miner.

Given the layout of chambers and tunnels together with the height of each miner, write a program that reports the largest number of miners who can extract gold at the same time. Each chamber can hold at most one miner.

Input

The first line contains a single integer TT (1T51 \le T \le 5), the number of datasets. The datasets follow.

The first line of each dataset contains two integers nn and kk (3n2000003 \le n \le 200000, 1kn1 \le k \le n): the number of chambers (numbered from 11 to nn) and the number of the entrance chamber.

The next n1n-1 lines describe the tunnels. Each line contains three integers aa, bb, cc (1a<bn1 \le a < b \le n, 1c10001 \le c \le 1000), meaning that chambers aa and bb are joined by a tunnel of height cc. No pair of chambers appears more than once.

The next line contains a single integer mm (1m2000001 \le m \le 200000), the number of miners assigned to this mine. The following line contains mm positive integers, each at most 10001000, giving the heights of the miners.

Output

Print TT lines. Line ii contains the answer for the ii-th dataset: the largest number of miners who can extract gold at the same time. A miner may pass through a tunnel only if its height is at least the miner's height.