You will be given some numbers. Then there will contain some queries. In every query there will be given a range and a number. You have to say that, the given number exists in the range of values or not.
First line will contain two integer number n and q. Where n dentoes number of elements in the array and q denotes total number of queries.(1 ≤ n ≤ 105, 1 ≤ q ≤ 105)
Then there will be contained n number of elements ai.(1 ≤ ai ≤ 109)
Then there will be contained q lines which contains three numbers l,r and x; where l,r denotes the range of index and x denotes the number which you have to check that exist or not exist.(1 ≤ l ≤ r ≤ n and 1 ≤ x ≤ 109)
There will be q lines of output. In every line if the number is contained in given range of values than you have to print "YES" otherwise you have to print "NO".
Input | Output |
---|---|
5 5 1 2 3 4 5 1 5 1 1 2 3 1 1 1 2 5 1 2 4 3 | YES NO YES NO YES |