Bob loves squares! More specifically, he loves perfect squares. He has a collection of cards, numbered from to , each with a value written on it.
Bob has queries of the form l r
. He would like to know if the product of the values on the cards to , inclusive would form a perfect square.
Input Specification
The first line contains two integers, and , such that
The second line contains integers, the values on the cards,
The next lines, contain queries of the form l r
such that
Output Specification
For each query, print on a separate line yes
if the product is a perfect square and no
if it is not.
Subtasks
Subtask 1 (30%)
Subtask 2 (70%)
No further constraints.
Sample Input
4 3
9 3 5 15
0 0
1 2
1 3
Sample Output
yes
no
yes
Sample Explanation 1
From to , the only number is , which is a perfect square.
From to , the product is , which is not a perfect square.
From to , the product is , which is a perfect square.
Comments