There is a maze that can be represented as $$$n \times m$$$ grids. For convenience, we define $$$(x,y)$$$ as the grid in the $$$x$$$-th row and $$$y$$$-th column.
Initially, every grid is empty. Alice wants to design this maze. So she will place $$$k$$$ walls in the grids. Each wall is represented as $$$x_1,x_2,y$$$, where it means that $$$\forall x_1\le i \le x_2$$$, $$$(i, y)$$$ will becomes a part of this wall and cannot be passed by. Except wall grids, all of the other grids are empty. Alice ensures that after placing $$$k$$$ walls, all empty grids remain connected and the maze has at least one empty grid. And it is guaranteed that different walls have no common grids.
Now, Alice want to know, does any pair of empty grids have only one simple path connecting them?
If your are not familar with the definition of "simple path", here is it:
A simple path connecting empty grids $$$(x_s,y_s)$$$ and $$$(x_d,y_d)$$$ is defined as a sequence of grid positions $$$S=\{(x_1,y_1),(x_2,y_2)\cdots (x_{len},y_{len})\},(len\ge 2)$$$ that satisfies the following conditions:
If any two different empty grids $$$(x_s,y_s),(x_d,y_d),\{ (x_s,y_s)\ne (x_d,y_d)\}$$$ have exactly one simple path connecting them, output "YES". Otherwise, output "NO".
The first line contains three integers $$$n, m, k(1\le n, m \le 10^9, 1\le k \le 10^5)$$$, indicating the number of rows, the number of columns, and the number of walls.
For the next $$$k$$$ lines, each line contains three integers $$$x_1,x_2,y(1\le x_1\le x_2\le n, 1\le y\le m)$$$ indicating a wall placed in the maze.
It is guaranteed that each pair of empty grids has at least one simple path connecting them.
Output a string to represent the answer, "YES" or "NO".
5 3 22 5 11 4 3
YES
5 3 12 4 2
NO
2 4 22 2 11 1 4
NO
Sample explanations contains Alice's maze, with yellow squares representing walls and white squares representing empty grids.
| Название |
|---|


