AND = OR
Let’s call an array of integers [b[1]
, b[2]
, ..., b[m]
] good, if we can partition all of its elements into 2 nonempty groups, such that the bitwise AND of the elements in the first group is equal to the bitwise OR of the elements in the second group. For example, the array [1, 7, 3, 11] is good, as we can partition it into [1, 3] and [7, 11], where 1 OR 3 = 3 and 7 AND 11 = 3.
You are given an array [a[1]
, a[2]
, ..., a[n]
], and have to answer q queries of form: is subarray [a[l]
, a[l+1]
, ..., a[r]
] good?
Input
The first line contains two integer n, q (1 ≤ n ≤ 10^5
, 1 ≤ q ≤ 10^5
) - the length of the array and the number of the associated queries.
The second line contains n integers a[1]
, a[2]
, ..., a[n]
(0 ≤ a[i]
≤ 2^30
- 1) - the elements of the array.
The i-th of the next q lines contains 2 integers l[i]
, r[i]
(1 ≤ l[i]
≤ r[i]
≤ n), describing the i-th query.
Output
For each query, output YES, if the correspondent subarray is good, and NO, if it’s not.