There is a tree with $N$ vertices. The $1$\-st vertex is the root, and the parent of the $i$\-th vertex $(2\leq i\leq N)$ is $p _ i\ (1\leq p _ i\lt i)$.
Each non-root vertex has an **enemy** or a **medicine** on it. Takahashi wants to defeat all the enemies. Initially, his strength is $1$, and he is at vertex $1$. For $i=2,\ldots,N$, the information of the $i$\-th vertex is represented by a triple of integers $(t _ i,s _ i,g _ i)$ as follows.
* If $t _ i=1$, there is an enemy at the $i$\-th vertex. When Takahashi visits this vertex for the first time, if his strength is less than $s _ i$, Takahashi is defeated by the enemy and **loses**, after which he cannot move to other vertices. Otherwise, he defeats the enemy, and his strength increases by $g _ i$.
* If $t _ i=2$, there is a medicine at the $i$\-th vertex. When Takahashi visits this vertex for the first time, he takes the medicine, and his strength is multiplied by $g _ i$. (For a vertex with a medicine, $s _ i=0$.)
There are at most $10$ vertices with a medicine.
Takahashi can repeatedly move to an adjacent vertex. Determine if he can defeat all the enemies.
## Constraints
* $2\leq N\leq 500$
* $1\leq p _ i\lt i\ (2\leq i\leq N)$
* $t _ i\in\lbrace1,2\rbrace\ (2\leq i\leq N)$
* $t _ i=1\implies1\leq s _ i\leq 10 ^ 9\ (2\leq i\leq N)$
* $t _ i=2\implies s _ i=0\ (2\leq i\leq N)$
* $1\leq g _ i\leq 10 ^ 9\ (2\leq i\leq N)$
* There are at most $10$ vertices with $t _ i=2$.
* All input values are integers.
## Input
The input is given from Standard Input in the following format:
$N$
$p _ 2$ $t _ 2$ $s _ 2$ $g _ 2$
$p _ 3$ $t _ 3$ $s _ 3$ $g _ 3$
$\vdots$
$p _ N$ $t _ N$ $s _ N$ $g _ N$
[samples]