AT_aalc001_p 線引きゲーム

Description

There are $ 2N $ vertices on a circle, arranged clockwise in the order vertex $ 1 $ , vertex $ 2 $ , $ \ldots $ , vertex $ 2N $ . You are given a sequence of $ N $ pairs of integers $ ((A_1,B_1),(A_2,B_2),\ldots,(A_N,B_N)) $ . The $ 2N $ values $ A_1,\ldots,A_N,B_1,\ldots,B_N $ are all distinct. Process $ Q $ queries. In the $ j $ -th query, you are given integers $ l_j,r_j $ . Determine whether curves can be drawn satisfying all of the following conditions: - For each $ i=l_j,l_j+1,\ldots,r_j $ , draw $ 1 $ curve connecting vertex $ A_i $ and vertex $ B_i $ . - Every curve lies inside the circle or on its circumference. - No $ 2 $ distinct curves intersect. Each query is independent. Curves drawn in one query do not affect other queries.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ Q $ $ A_1 $ $ B_1 $ $ A_2 $ $ B_2 $ $ \vdots $ $ A_N $ $ B_N $ $ l_1 $ $ r_1 $ $ l_2 $ $ r_2 $ $ \vdots $ $ l_Q $ $ r_Q $

Output Format

Print $ Q $ lines. On the $ j $ -th line, print `Yes` if curves satisfying the conditions can be drawn for the $ j $ -th query, and `No` otherwise.

Explanation/Hint

### Sample Explanation 1 For query $ 1 $ , curves connecting vertices $ 1 $ and $ 10 $ , vertices $ 2 $ and $ 5 $ , and vertices $ 3 $ and $ 4 $ can be drawn without intersecting each other. For query $ 3 $ , a curve connecting vertices $ 6 $ and $ 8 $ and a curve connecting vertices $ 7 $ and $ 9 $ cannot be drawn without intersecting each other. ### Constraints - $ 2 \leq N \leq 2 \times 10^5 $ - $ 1 \leq Q \leq 2 \times 10^5 $ - $ 1 \leq A_i \lt B_i \leq 2N $ - $ (A_1,\ldots,A_N,B_1,\ldots,B_N) $ is a permutation of $ (1,2,\ldots,2N) $ . - $ 1 \leq l_j \leq r_j \leq N $ - All numerical values in the input are integers.