I. Can I Find My Candy?
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Rachel has $$$n$$$ bags of candy containing $$$1, 2, \ldots, n$$$ pieces of candy. However, since she tripped and fell down the stairs, her candy bags have now been randomly scattered across the floor. Being the organized person she is, Rachel decides to arrange the bags of candy in a line $$$a_1, a_2, \ldots, a_n$$$, such that the $$$i$$$-th bag of candy contains $$$a_i$$$ pieces of candy in it.

Rachel wants to answer the following query for each interval $$$[l, r]$$$: if she rearranges the candies bags with $$$a_l, a_{l + 1}, \dots, a_{r - 1}, a_r$$$ candies, can she have $$$l, l + 1, \ldots, r$$$ pieces of candy in each bag respectively for that section?

Input

The first line will contain $$$n, q$$$ ($$$1\leq n, q\leq 2\cdot 10^5$$$) — the number of bags of candy Rachel has and the number of queries respectively. Then, for the next $$$q$$$ lines, each line will contain two integers, $$$l_j, r_j$$$ ($$$1\leq l_j\leq r_j\leq n$$$), which represent the interval $$$[l, r]$$$ that Alice wants to perform the query on.

It is guaranteed that the sum of $$$n + q$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.

Output

For each query, respond either "YES" or "NO" (case insensitive, without the quotes) on a new line.

Example
Input
5 3
1 3 2 5 4
1 3
2 5
1 4
Output
YES
YES
NO
Note

For each query, we check if the subsequence of candies from bag $$$l$$$ to $$$r$$$ can be rearranged to match the increasing sequence $$$[l+1, r]$$$.

  • Query 1: Candies in bags 1 to 3: $$$[1, 3, 2]$$$. This can be rearranged to: $$$[1, 2, 3]$$$, which matches the sequence $$$[1, 2, 3]$$$. Result: YES
  • Query 2: Candies in bags 2 to 5: $$$[3, 2, 5, 4]$$$. This can be rearranged to: $$$[2, 3, 4, 5]$$$, which matches the sequence $$$[2, 3, 4, 5]$$$. Result: YES
  • Query 3: Candies in bags 1 to 4: $$$[1, 3, 2, 5]$$$. This cannot be rearranged to match the sequence $$$[1, 2, 3, 4]$$$. Result: NO