| IV DCC CODE CUP |
|---|
| Finished |

Magner Weira has a server with $$$n$$$ components. Each component works only within a certain temperature range: component $$$i$$$ tolerates temperatures from $$$l_i$$$ to $$$r_i$$$, inclusive. If the temperature leaves this range, the component burns out permanently.
Magner has been so busy that he has neglected the server for $$$m$$$ days. Worried that some components may have burned out, he checks the room's temperature records. The only available record lists the minimum temperature $$$a_j$$$ and maximum temperature $$$b_j$$$ reached on each day $$$j$$$.
For each component, determine the first day on which it burned out, or report that it is still working after these $$$m$$$ days.
The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \leq n \leq 10^{5}$$$, $$$1 \leq m \leq 10^{5}$$$), the numbers of components and days.
Each of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \leq l_i \leq r_i \leq 10^{5}$$$), the temperature limits of component $$$i$$$.
Each of the following $$$m$$$ lines contains two integers $$$a_j$$$ and $$$b_j$$$ ($$$1 \leq a_j \leq b_j \leq 10^{5}$$$), the minimum and maximum temperatures on day $$$j$$$.
Print $$$n$$$ lines. Line $$$i$$$ must contain the first day on which component $$$i$$$ burned out, or $$$-1$$$ if it is still working after all $$$m$$$ days. Days are numbered from $$$1$$$ to $$$m$$$.
6 410 201 10015 1612 185 119 1812 1614 209 1710 26
3 -1 1 2 1 2
3 21 1000005 51 15 51 5
-1 2 1
4 54 91 38 101 105 84 93 102 91 10
3 1 1 -1
Explanation for example 1
The first component tolerates temperatures between $$$10$$$ and $$$20$$$: it survives the first two days but burns out on the third, when the minimum is $$$9$$$. The third component burns out on the first day because the minimum, $$$12$$$, is below its lower limit of $$$15$$$. The second component tolerates all recorded temperatures.
| Name |
|---|


