F. Fifth Commandment
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

The coaches of TCMX 2025 are preparing the fifth contest. Racso came up with the idea of stealing the samples of the problems. Abraham and Ivan want to stop him, so they have protected the samples with laser beams. Each laser beam can be represented as a line segment from $$$(x_1,y_1)$$$ to $$$(x_2,y_2)$$$ parallel to one of the axis.

To verify how safe the test cases are, they will check $$$Q$$$ scenarios.

In each scenario, the initial position of Racso and the position of the samples are given. Racso will succeed in stealing the samples if he can move from his starting position to the place where the samples are located. Racso is represented as a point in the plane and fails if he touches any laser beam at any moment, even if it happens at the beginning or at the end of his path.

For each scenario, determine whether Racso can succeed.

Input

The first line contains two integers $$$n$$$ and $$$Q$$$ ($$$1 \leq n \leq 1000$$$, $$$1 \leq Q \leq 10^6$$$) — the number of laser beams and the number of scenarios.

Each of the next $$$n$$$ lines contains four integers $$$x_1, y_1, x_2, y_2$$$ ($$$|x_1|, |y_1|, |x_2|, |y_2|\leq 10^9$$$), describing a laser beam represented by the segment between $$$(x_1,y_1)$$$ and $$$(x_2,y_2)$$$. Each beam is either vertical or horizontal (i.e. it has either $$$x_1=x_2$$$ or $$$y_1=y_2$$$).

Then follow $$$Q$$$ lines. Each line contains four integers $$$x_s, y_s, x_t, y_t$$$ ($$$|x_s|,|y_s|,|x_t|,|y_t|\leq 10^9$$$), indicating that the starting position of Racso is $$$(x_s,y_s)$$$ and the position of the samples is $$$(x_t,y_t)$$$.

Output

For each scenario, print YES if Racso can succeed in reaching the samples, or NO otherwise.

Example
Input
4 3
0 0 0 5
4 0 4 5
-1 1 5 1
-1 4 5 4
2 2 5 5
2 2 4 4
2 2 3 3
Output
NO
NO
YES