Curtains
시간 제한1.5초메모리 제한1024 MB
구간들이 주어지고 각 질의에 대해 주어진 구간만 정확히 덮는 부분집합이 존재하는지 판정한다.
문제
Benson the Rabbit is organizing a performance on his plane!
He has a stage with sections numbered to from left to right. He also has curtains numbered from to .
Each of these curtains can be lowered. Lowering curtain covers sections to . A curtain configuration is a set of lowered curtains. Given a curtain configuration, a section () is covered if and only if there exists a lowered curtain such that .
Benson wants to give a total of performances, numbered from to . For each performance , Benson requires a curtain configuration such that the sections to are covered and nothing else is covered. More formally, for each ,
- If , section is covered.
- Otherwise, section is not covered.
For each of these performances, help Benson to determine if there exists a curtain configuration satisfying his requirements.
입력
The first line of input will contain spaced integers , and , representing the number of sections, curtains and performances respectively.
The next lines of input will contain spaced integers each. The -th of these lines will contain and respectively, describing the range of sections that curtain can cover.
The next lines of input will contain spaced integers each. The -th of these lines will contain and respectively, describing the range of sections that need to be covered for performance .
출력
Output lines, the -th of which should contain YES if it is possible to cover the required sections for the -th performance using the curtains, and NO otherwise.
제한
- (for all )
- (for all )