#P1830. 轰炸III

轰炸III

Description

After the bombings, there are yy key points. The commander wants to know whether each of them was ever bombed; if yes, how many times, and in which round the last time occurred.

Input Format

The first line contains four integers, n,m,x,yn,m,x,y.

The next xx lines each contain four integers x1,y1,x2,y2x_1,y_1,x_2,y_2, representing the top-left and bottom-right coordinates of the bombed rectangle (for example, 1,3,7,101,3,7,10 means the bombed area is the rectangle from (1,3)(1,3) to (7,10)(7,10)).

The next yy lines each contain two integers, representing the coordinates of a key point.

Output Format

Output yy lines. In each line, the first character is Y or N, indicating whether it was bombed; if it is Y, then after a single space output two integers: the number of times it was bombed and the round number of the last time.

10 10 2 3
1 1 5 5
5 5 10 10
3 2
5 5
7 1

Y 1 1
Y 2 2
N

Hint

For 100%100\% of the testdata, 1n,m1001\le n,m\le 100.

Translated by ChatGPT 5