#abc307f. [abc307_f]Virus 2

[abc307_f]Virus 2

Problem Statement

There are NN rooms numbered 11, 22, ldots\\ldots, NN, each with one person living in it, and MM corridors connecting two different rooms. The ii-th corridor connects room UiU_i and room ViV_i with a length of WiW_i.

One day (we call this day 00), the KK people living in rooms A1,A2,ldots,AKA_1, A_2, \\ldots, A_K got (newly) infected with a virus. Furthermore, on the ii-th of the following DD days (1leqileqD)(1\\leq i\\leq D), the infection spread as follows.

People who were infected at the end of the night of day (i1)(i-1) remained infected at the end of the night of day ii.
For those who were not infected, they were newly infected if and only if they were living in a room within a distance of XiX_i from at least one room where an infected person was living at the end of the night of day (i1)(i-1). Here, the distance between rooms PP and QQ is defined as the minimum possible sum of the lengths of the corridors when moving from room PP to room QQ using only corridors. If it is impossible to move from room PP to room QQ using only corridors, the distance is set to 1010010^{100}.

For each ii (1leqileqN1\\leq i\\leq N), print the day on which the person living in room ii was newly infected. If they were not infected by the end of the night of day DD, print \-1\-1.

Constraints

  • 1leqNleq3times1051 \\leq N\\leq 3\\times 10^5
  • 0leqMleq3times1050 \\leq M\\leq 3\\times 10^5
  • 1leqUi<VileqN1 \\leq U_i < V_i\\leq N
  • All (Ui,Vi)(U_i,V_i) are different.
  • 1leqWileq1091\\leq W_i\\leq 10^9
  • 1leqKleqN1 \\leq K\\leq N
  • 1leqA1<A2<cdots<AKleqN1\\leq A_1<A_2<\\cdots<A_K\\leq N
  • 1leqDleq3times1051 \\leq D\\leq 3\\times 10^5
  • 1leqXileq1091\\leq X_i\\leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN MM U1U_1 V1V_1 W1W_1 U2U_2 V2V_2 W2W_2 vdots\\vdots UMU_M VMV_M WMW_M KK A1A_1 A2A_2 ldots\\ldots AKA_K DD X1X_1 X2X_2 ldots\\ldots XDX_D

Output

Print NN lines.
The ii-th line (1leqileqN)(1\\leq i\\leq N) should contain the day on which the person living in room ii was newly infected.


Sample Input 1

4 4
1 2 2
2 3 1
2 4 3
3 4 2
1
1
2
3 3

Sample Output 1

0
1
1
2

The infection spreads as follows.

  • On the night of day 00, the person living in room 11 gets infected.
  • The distances between room 11 and rooms 2,3,42,3,4 are 2,3,52,3,5, respectively. Thus, since X1=3X_1=3, the people living in rooms 22 and 33 are newly infected on the night of day 11.
  • The distance between rooms 33 and 44 is 22. Thus, since X2=3X_2=3, the person living in room 44 also gets infected on the night of day 22.

Therefore, the people living in rooms 1,2,3,41,2,3,4 were newly infected on days 0,1,1,20,1,1,2, respectively, so print 0,1,1,20,1,1,2 in this order on separate lines.


Sample Input 2

7 7
1 2 2
2 3 3
3 4 1
4 5 1
5 6 3
3 7 1
4 7 1
2
1 6
2
2 3

Sample Output 2

0
1
2
-1
2
0
-1

Sample Input 3

5 1
1 2 5
2
1 3
3
3 7 5

Sample Output 3

0
2
0
-1
-1

Note that it is not always possible to move between any two rooms using only corridors.