The first line is an integer T which indicates the case number.
and as for each case,
the first line are two integer n and m which indicate the number of time segment of skipping the class and the game types luras wants to try.
then there are n lines, for the i-th line, there are 2 integers L[i] and R[i], which mean that luras could skip the class for games at the R[i] - L[i] + 1 time point { L[i], L[i] + 1, ..., R[i] - 1, R[i] }.
then there are m lines, for the i-th line, there are 3 integers l[i], r[i] and d[i], which mean that only during the r[i] - l[i] + 1 time point { l[i], l[i] + 1, ..., r[i] - 1, r[i] }, could luras play the i-th type game.
once luras spends a d[i] continuous time segment during [ l[i], r[i] ], she could finish 1 round of the i-th game.
At last please note luras could only play at most 1 round game at a time point, she is a cut noob : ) .
It is guaranteed that——
1 <= T <= 1000
1 <= L[1] <= R[1] < L[2] <= R[2] < ... < L[n] <= R[n] <= 10^9
1 <= l[] <= r[] <= 10^9
1 <= d[] <= 10^9
for 99% cases,1 <= n, m <= 100
for 100% cases,1 <= n, m <= 10000