There are $$$N$$$ bricks numbered from $$$1$$$ to $$$N$$$ and $$$M$$$ colors numbered from $$$1$$$ to $$$M$$$. Each brick $$$i$$$ has a size $$$A_i$$$ and color $$$B_i$$$. It is guaranteed that there is at least one brick of each color.
A tower made of some set of bricks is called $$$k$$$-beautiful if the absolute difference in sizes between every two adjacent bricks is at most $$$k$$$.
Your task is to answer $$$Q$$$ queries. The $$$j$$$-th query is: can at least one $$$K_j$$$-beautiful tower be made using all the bricks of the colors $$$X_j$$$ and $$$Y_j$$$ and no bricks of any other colors? It is guaranteed that $$$X_j$$$ and $$$Y_j$$$ are distinct.
The first line contains two integers, $$$N$$$ and $$$M$$$.
The next $$$N$$$ lines describe the bricks. The $$$i$$$-th of these lines contains two integers $$$A_i$$$ and $$$B_i$$$.
The next line contains a single integer, $$$Q$$$.
The next $$$Q$$$ lines describe the queries. The $$$j$$$-th of these lines contain three integers, $$$K_j$$$, $$$X_j$$$ and $$$Y_j$$$.
Constraints
For each query, you should print either YES or NO on a separate line.
8 45 110 22 220 333 46 117 242 1513 3 47 2 325 1 320 1 220 2 4
YES NO YES NO YES
5 25 15 110 215 120 215 1 2
YES
10 435 492 397 319 120 184 411 126 260 329 3108 2 410 2 434 2 343 2 347 1 224 2 330 3 445 1 346 1 414 2 3
NO NO YES YES YES NO YES YES NO NO
| Name |
|---|


