B. Nanami and Rectangles Putting Problem
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

Nanami traveled to the Kingdom of Rectangles, where there are all kinds of rectangles. Here, she also finds a rectangular clearing of size $$$n\times m$$$ with the coordinates of the lower left corner of the clearing being $$$(0,0)$$$ and the coordinates of the upper right corner being $$$(n,m)$$$.

Nanami is a curious girl who places and removes rectangles within the empty space, and she wants to ask you if every square of that empty space is covered and only covered only $$$1$$$ time after each operation.

Input

In the first line, an integer $$$t(1\le t \le 10^4)$$$, representing the number of groups in each data set.

For each group of data:

In the first row, three integers $$$n,m,q(1\le n,m \le 10^9;1\le q \le 2·10^5)$$$, representing the size of the matrix and the number of operations, respectively.

The next $$$q$$$ rows, each with $$$5$$$ integers $$$op,a,b,c,d(0\le op \le 1;0\le a\lt c \le n;0\le b\lt d \le m)$$$, represent the type of operation and the position of the matrix where the operation is performed. Where $$$op=0$$$ represents the removal matrix and $$$op=1$$$ represents the placement matrix, it is guaranteed that the removed matrices were originally placed and that for each removal, if more than one matrix position is duplicated, only $$$1$$$ is removed.

It is guaranteed that the sum of $$$q$$$ within the same test point does not exceed $$$2·10^5$$$.

Output

After each operation, output a line "YES" if every square in the empty space is covered and only $$$1$$$ times; otherwise, output a line "NO".

You can output "YES" and "NO" in any case form (e.g., the strings "yES", "yes", and "Yes" will all be treated as affirmative answers).

Example
Input
3
3 4 6
1 0 0 3 4
1 0 0 3 4
0 0 0 3 4
0 0 0 3 4
1 0 0 2 4
1 2 0 3 4
1 1 1
1 0 0 1 1
4 3 8
1 0 0 4 3
1 0 0 4 3
1 0 0 4 3
1 0 0 4 2
0 0 0 4 3
0 0 0 4 3
1 0 2 4 3
0 0 0 4 3
Output
YES
NO
YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES