First line contains an integer $T$, which indicates the number of test cases.
Every test case begins with two integers $N$ and $M$, which is the numbers of tanks and numbers of results.
The second line of each test case contains $N - 1$ integers, $h_1$, $h_2$, $\cdots$, $h_{N-1}$, and $h_i$ indicates the height of $i^{th}$ board's height.
Then $M$ lines follow, the $i^{th}$ line, formated as '$x\ y\ z$', indicates $i^{th}$ result. $z$ is $0$ if there is no water at height $(y + 0.5)$ in $x^{th}$ tank, otherwise $z$ is $1$.
$\cdot$ $1 \leq T \leq 100$.
$\cdot$ For 90% data, $1 \leq N \leq 1000$ and $1 \leq M \leq 2000$
$\cdot$ for 100% data, $1 \leq N \leq 10^5$ and $1 \leq M \leq 2 \cdot 10^5$.
$\cdot$ $1 \leq h_i \leq 10^9$ for all $1 \leq i \leq N - 1$.
$\cdot$ for every result, $1 \leq x \leq N$, $1 \leq y \leq 10^9$ and $z$ is either $0$ or $1$.