The first line contains a single integer $T$ ($1 \leq T \leq 1\,000$), the number of test cases. For each test case:
The first line of the input contains two integers $n$ and $m$ ($1 \leq n \leq 100\,000$, $1\leq m\leq 2n$), denoting the number of intersections and the number of one-way streets.
In the next $n$ lines, the $i$-th line contains three integers $x_i$, $y_i$ and $w_i$ ($0\leq x_i,y_i\leq 10^9$, $1\leq w_i\leq 10^9$), describing the $i$-th intersection. It is guaranteed that no two intersections share the same coordinator.
Each of the next $m$ lines contains two integers $u_i$ and $v_i$ ($1 \leq u_i, v_i \leq n$, $x_{u_i} < x_{v_i}$), denoting a one way street from $u_i$ to $v_i$. It is guaranteed that each pair of $u_i$ and $v_i$ will be described at most once.
It is guaranteed that the sum of all $n$ is at most $1\,500\,000$.