The first line of input contains a integer $T (T \leq 10)$ representing the number of test cases.
For each test case there are three integers $n, m, p$ on the first line $(1 \leq n \leq 200, 1 \leq m \leq 200, 0 \leq p \leq 50000)$, representing the number of different desserts, the number of different trucks and the least energy required respectively.
The $i-th$ of the $n$ following lines contains three integers $t_i, u_i, v_i (1 \leq t_i \leq 100, 1 \leq u_i \leq 100, 1 \leq v_i \leq 100)$ indicating that the $i-th$ dessert can provide $t_i$ energy, takes up space of size $u_i$ and that Bell can prepare at most $v_i$ of them.
On each of the next $m$ lines, there are also three integers $x_j , y_j , z_j (1 \leq x_j \leq 100, 1 \leq y_j \leq 100, 1 \leq z_j \leq 100)$ indicating that the $j-th$ truck can carry at most size of $x_j$ , hiring each one costs $y_j$ and that Bell can hire at most $z_j$ of them.