B. Corgi Hike
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Alex and his corgi are going on a hike! They are traversing a 1-dimensional hiking path of length $$$N$$$ where each position $$$i\ (1 \leq i \leq N)$$$ has elevation $$$e_i$$$.

He's curious about the view at different locations along the hike. Specifically, he has $$$q$$$ queries where he's wondering if location $$$j$$$ is visible from location $$$i$$$, which is the case when there's no location between $$$i$$$ and $$$j$$$ with an elevation greater than or equal to the max of $$$e_i$$$ and $$$e_j$$$. For each query, determine if location $$$j$$$ is visible from location $$$i$$$.

Input

The first line will contain two space-separated integers, $$$N\ (1 \leq N \leq 10^5)$$$ and $$$q\ (1 \leq q \leq 100)$$$, denoting the length of the hiking path and the number of queries, respectively.

The second line will contain $$$N$$$ space separated integers $$$e_1, e_2, \dots e_N\ (1 \leq e_i \leq 10^9)$$$ representing the elevations of the $$$N$$$ positions in the hiking path.

The final $$$q$$$ lines will each contain two space-separated integers $$$i$$$ and $$$j\ (1 \leq i, j \leq N)$$$, representing a query.

Output

Output $$$q$$$ lines, each containing a single string "yes" or "no" (case insensitive), representing the result of a query.

Example
Input
9 6
9 6 3 3 4 6 1 4 8
1 6
1 3
3 4
3 7
5 8
6 9
Output
yes
yes
yes
no
no
yes