You have a sequence of n integers and queries. In each query, you are given three integers , and . You have to answer the following question:
Is it possible to select some integers from the segment such that their LCM is divisible by and no two consecutive integers are selected? That is, if you select , you cannot select .
Here LCM means the Least Common Multiple of numbers.
The first line of input contains two space-separated integers and denoting the number of integers and the number of queries.
The next line contains space-separated integers .
Following lines contain three integers each. , and .
For each query, print Yes or No in a single line, the answer to the query.
6 5 4 7 3 5 12 22 1 5 10 2 5 10 5 5 12 3 5 10 1 4 20
Yes No Yes No Yes