## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## Rooks Defenders Codeforces Solution | Codeforces Problem Solution 2022

C. Rooks Defenders
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You have a square chessboard of size $n×n$. Rows are numbered from top to bottom with numbers from $1$ to $n$, and columns — from left to right with numbers from $1$ to $n$. So, each cell is denoted with pair of integers $\left(x,y\right)$ ($1\le x,y\le n$), where $x$ is a row number and $y$ is a column number.

You have to perform $q$ queries of three types:

• Put a new rook in cell $\left(x,y\right)$.
• Remove a rook from cell $\left(x,y\right)$. It's guaranteed that the rook was put in this cell before.
• Check if each cell of subrectangle $\left({x}_{1},{y}_{1}\right)-\left({x}_{2},{y}_{2}\right)$ of the board is attacked by at least one rook.

Subrectangle is a set of cells $\left(x,y\right)$ such that for each cell two conditions are satisfied: ${x}_{1}\le x\le {x}_{2}$ and ${y}_{1}\le y\le {y}_{2}$.

Recall that cell $\left(a,b\right)$ is attacked by a rook placed in cell $\left(c,d\right)$ if either $a=c$ or $b=d$. In particular, the cell containing a rook is attacked by this rook.

Input

The first line contains three integers $n$ and $q$ ($1\le n\le {10}^{5}$$1\le q\le 2\cdot {10}^{5}$) — the size of the chessboard and the number of queries, respectively.

Each of the following $q$ lines contains description of a query. Description begins with integer $t$ ($t\in \left\{1,2,3\right\}$) which denotes type of a query:

• If $t=1$, two integers $x$ and $y$ follows ($1\le x,y\le n$) — coordinated of the cell where the new rook should be put in. It's guaranteed that there is no rook in the cell $\left(x,y\right)$ at the moment of the given query.
• If $t=2$, two integers $x$ and $y$ follows ($1\le x,y\le n$) — coordinates of the cell to remove a rook from. It's guaranteed that there is a rook in the cell $\left(x,y\right)$ at the moment of the given query.
• If $t=3$, four integers ${x}_{1},{y}_{1},{x}_{2}$ and ${y}_{2}$ follows ($1\le {x}_{1}\le {x}_{2}\le n$$1\le {y}_{1}\le {y}_{2}\le n$) — subrectangle to check if each cell of it is attacked by at least one rook.

It's guaranteed that among $q$ queries there is at least one query of the third type.

Output

Print the answer for each query of the third type in a separate line. Print "Yes" (without quotes) if each cell of the subrectangle is attacked by at least one rook.

Otherwise print "No" (without quotes).