QOJ.ac

QOJ

Time Limit: 5.0 s Memory Limit: 256 MB Total points: 100

#19998. Quadruples of Points

Statistics

“I have a rule,” — said the manager, — “always do only half of the work.”

“Why do you have such rule?” — asked Cheburashka.

— It’s simple, — said Ivan Ivanovich. — If I’ll do all the work and agree with everything, then everybody will say that I’m too kind and that you can do anything under my command. Otherwise, if I’ll do no work at all and decline everything, I will be considered lazy and basically worthless. So, doing only half of the work is ideal because nobody can say anything bad about me. Do you understand now?

E. Uspenskiy, “Gena the Crocodile and his Friends”

Geologists of Flatland are planning an important research. For this purpose, they prepared $n$ sets of points, and are going to make measurements at these points. Each set consists of four distinct points, defined by their two-dimensional coordinates.

The prepared sets must be approved by $m$ managers. Each manager chooses a rectangle with sides parallel to coordinate axes and approves measurements at all points inside the rectangle or on its border.

A manager is called fantastic if for each given set of points, he approves exactly half of the points. Determine for each manager if he is fantastic or not.

Input

The first line contains two integers $n$ and $m$: the number of point sets and the number of managers ($1 \le n \le 200\,000$, $1 \le m \le 200\,000$). Then follow $n$ groups of lines, four lines in each group. Each line contains two integers: the coordinates of the next point. In each set, all points are pairwise distinct. The next $m$ lines describe rectangles: four integers $x_1,y_1,x_2,y_2$ per line ($x_1 \le x_2$, $y_1 \le y_2$).

All coordinates do not exceed $10^9$ by absolute value.

Output

For each manager, print “YES” if, for each given set of points, he approves exactly half of the points, and “NO” otherwise.

Examples

Input 1

2 3
0 0
0 1
1 0
1 2
2 0
2 -1
2 -2
2 -3
0 -1 2 0
0 -1 2 1
0 0 0 1

Output 1

YES
NO
NO

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.