#P1847. 轰炸II

轰炸II

Description

A city has been bombed MM times. Each time, the bombed area is a rectangle whose sides are parallel to the axes.

After the bombings, there are NN key points. The commander wants to know whether each point has ever been bombed; if so, how many times it was bombed, and in which round it was last bombed.

Input Format

The first line contains two integers: M,NM, N.

Each of the next MM lines contains four integers: x1x_1, y1y_1, x2x_2, y2y_2, representing the top-left and bottom-right coordinates of the bombed rectangle (for example, 1 3 7 10 means the bombed area is the rectangle from (1,3)(1,3) to (7,10)(7,10)).

Then the next NN lines each contain two integers, representing the coordinates of a key point.

Output Format

Output NN lines.

In each line, the first token is YES or NO, indicating whether the point was bombed. If it is YES, after a space output two integers: the number of times it was bombed, and the round number of the last bombing.

1 1 
1 1 10 10
11 11
NO

Hint

1N,M20001 \le N, M \le 2000

1x1,y1,x2,y223211 \le x_1, y_1, x_2, y_2 \le 2^{32} - 1

Translated by ChatGPT 5