You are a farmer. You own $$$F$$$ fields of land, which are arranged in a straight line. They are numbered $$$1 \ldots F$$$ from left to right.
You have recently acquired a crop duster, which is an airplane that can quickly spray fertilizer over a large amount of land. The crop duster is preprogrammed with $$$N$$$ possible trips, numbered $$$1 \ldots N$$$. In trip $$$i$$$, the crop duster flies over the fields $$$L_i \ldots R_i$$$, where $$$1 \leq L_i \leq R_i \leq F$$$, and sprays fertilizer over all these fields.
You now plan to use a consecutive set of preprogrammed trips. You would like to answer $$$Q$$$ questions, where the $$$j$$$-th question is the following:
The first line contains a single integer $$$F$$$, the number of fields.
The second line contains a single integer $$$N$$$, the number of preprogrammed trips.
The next $$$N$$$ lines describe the trips. The $$$i$$$-th of these lines contains two integers $$$L_i$$$ and $$$R_i$$$.
The next line contains a single integer $$$Q$$$, the number of questions you wish to answer.
The next $$$Q$$$ lines describe the questions. The $$$j$$$-th of these lines contains two integers $$$X_j$$$ and $$$Y_j$$$.
You should print $$$Q$$$ lines of output. The $$$j$$$-th line should consist of a single integer, the answer to the $$$j$$$-th question.
The test data for this problem is divided into multiple subtasks. In order to pass a subtask, your submitted program must solve every test case within that subtask correctly and within the time and memory limits.
You will be awarded the points allocated to a subtask if at least one submission you make during the contest passes that subtask. You do not need to combine your solutions for multiple subtasks into a single submission.
Please keep in mind that the subtasks are not necessarily arranged in increasing order of difficulty. We encourage you to try as many subtasks as possible.
Constraints
In all test data, it is guaranteed that:
Subtasks
531 42 34 541 22 31 31 1
4 4 5 4
1041 42 57 88 1041 41 24 43 4
9 5 3 4
1054 82 21 35 79 1051 11 21 31 41 5
5 6 8 8 10
1051 42 103 65 82 651 23 43 54 55 5
10 6 7 7 5
1071 42 34 75 103 56 81 251 72 53 46 71 3
10 9 7 5 7
In the first sample, there are $$$3$$$ trips : Trip $$$1$$$ being from field $$$1$$$ to $$$4$$$, trip $$$2$$$ being from field $$$2$$$ to $$$3$$$ and trip $$$3$$$ being from field $$$4$$$ to $$$5$$$.
In the first query, trips $$$1$$$ and $$$2$$$ are in consideration, and we can see fields $$$1$$$ and $$$4$$$ will be fertilized once, fields $$$2$$$ and $$$3$$$ twice, and field $$$5$$$ none. Thus, the answer is $$$4$$$.
Sample $$$1$$$ is valid for Subtasks $$$1$$$, $$$3$$$, $$$6$$$, $$$9$$$ and $$$10$$$.
Sample $$$2$$$ is valid for Subtasks $$$1$$$, $$$3$$$, $$$5$$$, $$$6$$$, $$$9$$$ and $$$10$$$.
Sample $$$3$$$ is valid for Subtasks $$$1$$$, $$$2$$$, $$$3$$$, $$$6$$$, $$$9$$$ and $$$10$$$.
Sample $$$4$$$ is valid for Subtasks $$$1$$$, $$$3$$$, $$$6$$$, $$$8$$$, $$$9$$$ and $$$10$$$.
Sample $$$5$$$ is valid for Subtasks $$$1$$$, $$$3$$$, $$$6$$$, $$$9$$$ and $$$10$$$.