Since Mr. DeMello hates flavour text, he decides to give you a sleek statement instead:
Given
intervals of
, answer
queries.
Each query comes in the form
L_i R_i
, where you will check if you can move fromto
while always being on an interval (i.e., every integer on that interval must be contained in at least one of the
intervals).
Output
Y
if you can cover the range; otherwise, output
N
if you cannot cover the range.
Can you help Mr. DeMello?
Constraints
Input Specification
The first line will contain two integers, and
, the number of intervals and the number of queries, respectively.
The next lines will contain two integers,
and
, the endpoints of the
interval.
The next lines will contain two integers,
and
, the endpoints of the
query.
Output Specification
Output lines, the answers to the queries.
Sample Input
4 3
7 9
-5 4
10 14
16 19
8 10
-5 -5
11 18
Sample Output
Y
Y
N
Comments
Is there any overlaps in the intervals?