Under construction

Still being built. Things may change

Little Red Riding Hood

Time limit2sMemory limit64 MB

Summary
Given the Wolf's fixed route and his per-run times, find a path for Red from clearing 1 to clearing N that arrives before the Wolf, or report NO.
Level

Hard8 of 10

Topics
Shortest path, Graph, Simulation
Solved
No attempts yet

Problem

An impassable forest has NN clearings and MM paths between them. Each path connects two different clearings. Two clearings may be connected by several paths.

Little Red Riding Hood and her grandmother live in two different clearings. Red's house is in clearing 11, and the grandmother's house is in clearing NN. Red knows the minimum time she needs to walk each path. She switches from one path to another only at clearings. Every clearing has a shelter where Red can hide for some time.

A Wolf also lives in this forest. The time the Wolf takes to run along a path may differ from the time Red takes on the same path. If the Wolf runs the same path several times, each run may take a different amount of time.

The Wolf saw Red at the edge of her clearing as she set out to bring pies to her grandmother. He started running along the usual route from Red's house to the grandmother's house at the moment she decided to leave. His route ends as soon as he reaches the grandmother's clearing. The Wolf never stops at any clearing.

To find her grandmother safe, Red must overtake the Wolf. She may never be on the same path as the Wolf, even if the Wolf is just leaving the path while she is just entering it, or the reverse. To avoid meeting the Wolf at a clearing, Red uses the shelter there. Red may not enter a clearing at the same time as the Wolf, and she may not leave a shelter at the moment the Wolf enters that clearing. If needed, Red may take a path longer than the minimum time, and she may leave home later than she first planned.

Write a program that helps Red reach her grandmother before the Wolf, given the sequence of paths the Wolf runs.

Input

The first line contains three integers NN, MM, and KK (2≤N≤2 0002 \le N \le 2\,000, 1≤M≤100 0001 \le M \le 100\,000, 1≤K≤100 0001 \le K \le 100\,000). Each of the next MM lines contains three integers BiB_i, EiE_i, and TiT_i, where BiB_i and EiE_i are the clearings connected by the ii-th path, and TiT_i is the minimum time Red needs to walk it (1≤Ti≤10 0001 \le T_i \le 10\,000).

Each of the next KK lines contains two integers PiP_i and ViV_i. PiP_i is the number of the path the Wolf runs along, and ViV_i is the time he spends on it (1≤Vi≤10 0001 \le V_i \le 10\,000). The Wolf's route always starts at clearing 11 and ends at clearing NN.

All numbers in the input are integers, and numbers on the same line are separated by spaces.

Output

If Red cannot reach her grandmother's house faster than the Wolf, print NO.

If Red can reach it faster than the Wolf, print YES on the first line. On the second line, print the number of paths in Red's route. On the third line, print the numbers of the paths in the order Red walks them, separated by spaces. Do not print the travel times on the paths or the times spent at clearings.

Examples2

  1. Example 1

    Input
    4 4 5
    1 3 6
    1 2 2
    2 3 2
    3 4 1
    2 1
    2 2
    2 1
    3 4
    4 1
    
    Expected output
    YES
    2
    1 4
    
  2. Example 2

    Input
    4 3 4
    1 2 2
    2 3 1
    2 4 3
    1 2
    2 1
    2 2
    3 5
    
    Expected output
    NO