QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#15345. Commander-in-chief! No!

Statistics

Commander! No!

In this round of interstellar warfare, we have established $n$ gravity slingshot devices in the universe. We use them for cargo transport.

In the previous round of star wars, the wormhole system was too fragile, and we were always unable to counterattack, resulting in a dimensional reduction strike by the enemy's dual-vector foil. Therefore, the universe we are currently in is two-dimensional, and we use coordinates in a Cartesian coordinate system to represent the positions of objects.

Our $i$-th gravity slingshot device is located at coordinates $(x_i, y_i)$. A gravity slingshot device can help unpowered cargo ships move, and its principle is as follows:

  • To save energy, cargo ships are unpowered and can only move by using gravity slingshot devices.
  • For a cargo ship located at $(a, b)$, one can choose a gravity slingshot device located at the same horizontal coordinate, say $(a, c)$. Activating this device will cause the cargo ship to immediately move to the symmetric position with respect to the device, which is $(a, 2c - b)$.
  • For a cargo ship located at $(a, b)$, one can choose a gravity slingshot device located at the same vertical coordinate, say $(d, b)$. Activating this device will cause the cargo ship to immediately move to the symmetric position with respect to the device, which is $(2d - a, b)$.
  • During the movement process, it is permissible for the cargo ship to coincide with the coordinates of some gravity slingshot devices, because a coordinate point actually represents a war zone, which does not exclude the coexistence of multiple objects.

To provide timely supplies in battle, we need to use gravity slingshot devices to transport cargo. The Commander will give you $q$ transport requests. The $i$-th request is in the form $(s_i, t_i, u_i, v_i)$, asking whether an unpowered cargo ship located at $(s_i, t_i)$ can be transported to the strategic location $(u_i, v_i)$ by using gravity slingshot devices a number of times.

For each query, you do not need to solve for the specific movement process, nor do you need to calculate the scheme with the minimum number of moves, as these will be calculated by the specialized departments under the command headquarters. You only need to tell the Commander whether each transport request is feasible. For each query, if there exists a transport scheme that can deliver the cargo ship to the corresponding strategic location, output "YES", otherwise output "NO".

Input

The first line contains two positive integers $n, q$ ($1 \le n \le 3000, 1 \le q \le 10^5$), representing the number of gravity slingshot devices and the number of queries from the Commander, respectively.

The next $n$ lines each contain two integers $x_i, y_i$, representing the coordinates of the $i$-th gravity slingshot device.

The next $q$ lines represent the queries, where the $i$-th line contains four integers $s_i, t_i, u_i, v_i$, representing the coordinates of the cargo ship and the coordinates of the corresponding strategic location, respectively.

It is guaranteed that all input coordinates are integers with an absolute value within $10^8$ (inclusive).

Output

Output $q$ lines, where the $i$-th line represents the answer to the $i$-th query. If the transport is possible, output "YES", otherwise output "NO".

Specifically, if the cargo ship's position and the strategic location coincide in a query, it is considered reachable; please output "YES" directly.

Examples

Input 1

2 3
3 3
5 5
3 6 3 0
1 3 5 7
2 3 5 3

Output 1

YES
YES
NO

Input 2

3 2
2 1
2 2
3 2
1 2 6 2
1 1 3 2

Output 2

NO
NO

Note

Special hint: Regrettably, if you only output "NO", you will likely only pass the second example.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.