The first line contains three space-separated integers $n (2 ≤ n ≤ 100,000)$, $m (1 ≤ m ≤ n−1)$ and $k (1 ≤ k ≤ 100,000)$ – the number of vertices, the number of fruits, and the maximum day on which a fruit may become ripe.
The following $n−1$ lines contain the integers $p_2,...,p_n$, one per line. For each $i$ (from $2$ to $n$, inclusive), vertex $p_i (1 ≤ p_i ≤ i−1)$ is the parent of vertex $i$.
Each of the last m lines describes one fruit. The $j$-th of these lines has the form “$v_j\ d_j\ w_j$” $(2 ≤ v_j ≤ n, 1 ≤ d_j ≤ k, 1 ≤ w_j ≤ 10^9)$.
It is guaranteed that no vertex contains more than one fruit (i.e., the values $v_j$ are distinct).