The admission interview at the prestigious University of Cambridge consist of tasks, numbered from to . Alex is there right now, waiting to attend the interview. Takahiro Wong, who has just finished his interview, solved all the tasks. More precisely, he solved the -th problem after seconds from the beginning of the interview.
Knowing the fact that he can solve the -th problem in seconds, Alex asks himself questions: . For every question, Alex will consider only the tasks from the interval and he wants to know whether he can solve each of these tasks before Takahiro Wong. (Alex can solve the tasks from the interval in any order).
For example, let’s consider that Alex has to solve the tasks and (in this order). He will finish task after seconds, and task after seconds. Alex will solve both problems before Takahiro Wong if and .
Both Takahiro Wong and Alex will start their interviews at second .
Task
Help Alex answer correctly to all questions.
Input data
- The first line of the standard input will contain and .
- - the number of tasks
- - the number of questions.
- On the following lines, there will be and .
- - the time needed for Alex to solve the -th problem
- - the time (from the beginning of his interview) after Takahiro Wong will solve the -th problem.
- On the following lines, there will be and , representing the interval .
Output data
The standard output will contain lines, the answers to the questions.
The -th line will contain:
- , if Alex cand solve all the tasks from the interval before Takahiro Wond
- , otherwise.
Restrictions
- The values are not distinct (there can be a value that appears multiple times)
- Alex can’t solve tasks in the same time, but Takahiro Wong can (The values are not distinct).
# | Points | Restrictions |
---|---|---|
1 | 15 | |
2 | 25 | |
3 | 15 | , |
4 | 45 |
Example
stdin
4 3
1 10
14 18
2 7
10 12
3 4
2 4
1 3
stdout
0
0
1
Explanation
The rd question refers to the interval :
- There are ways Alex can solve the tasks: , , , , , .
- If he solves the tasks in the order , we have to fulfill the following relations: , and . We can see that all of them are true.
- Because Alex found at least one way to solve all the problems before Takahiro Wong, the answer is for the third question.