Tickets

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

There are nn cities in Berland, which are enumerated from 11 to nn. City number 11 is a capital of Berland. Cities are connected by n1n-1 trains, ii-th of them connects city a_ia\_i with city b_ib\_i. Berland train system allows you to get from every city to any other, possibly, using more than one train.

There are mm types of the tickets: ii-th of them can be bought in city v_iv\_i for w_iw\_i berland dollars and allows to travel from v_iv\_i to any city xx such that the distance from v_iv\_i to xx is less or equal to k_ik\_i. The distance is measured in trains used during the travel.

Your task is to find minimal cost to get from some cities to capital.

입력

In the first line you are given three integers nn, mm, qq (1n1051 \le n \le 10^5, 0m1050 \le m \le 10^5, 1q1051 \le q \le 10^5) -- number of cities in Berland, number of different type of tickets, number of queries correspondingly.

Each of next n1n - 1 lines contain integers a_ia\_i and b_ib\_i (1a_i,b_in1 \le a\_i, b\_i \le n) -- cities connected by ii-th train.

In the next mm lines types of tickets are described: ithi^{th} contains three integers v_iv\_i (1v_in1 \le v\_i \le n) -- city where one could buy and use it, k_ik\_i (1k_in11 \le k\_i \le n - 1) -- maximum distance one could travel using this ticket, w_iw\_i (0w_i1090 \le w\_i \le 10^9) -- price of the ticket.

In the next qq lines are described queries: ithi^{th} of them contains integer q_iq\_i (1q_in1 \le q\_i \le n) -- city, from which you want to calculate cost to get to capital.

출력

For every query output single line with integer -- required cost to get from city to capital. If it's impossible to get to the capital using such tickets, print <<Impossible>> (without quotes).

힌트

In the first sample, to get to the capital from the city 55, we need to perform the following actions:

  • Buy a ticket with type 11 for 1010 dollars and travel to the city 44.
  • Buy a ticket with type 33 for 11 dollar and travel to the capital city 11.

Note that it's also possible to travel to the cities 33 and 22 using a ticket with type 11 (the distance between 55 and 33 is one train, while the distance between 55 and 22 is two trains, which is less or equal to 22), and get to the capital using tickets 22 or 44, but it would be a lot more expensive to travel to the capital this way.