#abc238g. [abc238_g]Cubic?

[abc238_g]Cubic?

Problem Statement

Given a sequence AA of NN numbers, answer the following QQ questions.

  • In the ii-th question, you are given integers LiL_i and RiR_i. Is $A_{L_i} \\times A_{L_i+1} \\times \\dots \\times A_{R_i}$ a cubic number?

Here, a positive integer xx is said to be a cubic number when there is a positive integer yy such that x=y3x=y^3.

Constraints

  • All values in input are integers.
  • 1leN,Qle2times1051 \\le N,Q \\le 2 \\times 10^5
  • 1leAile1061 \\le A_i \\le 10^6
  • 1leLileRileN1 \\le L_i \\le R_i \\le N

Input

Input is given from Standard Input in the following format:

NN QQ A1A_1 A2A_2 dots\\dots ANA_N L1L_1 R1R_1 L2L_2 R2R_2 vdots\\vdots LQL_Q RQR_Q

Output

Print QQ lines.
The ii-th line should contain Yes if, in the ii-th question, $A_{L_i} \\times A_{L_i+1} \\times \\dots \\times A_{R_i}$ is a cubic number, and No otherwise.
The checker is case-insensitive; output can be either uppercase or lowercase.


Sample Input 1

8 5
7 49 30 1 15 8 6 10
1 2
2 3
4 4
5 8
3 8

Sample Output 1

Yes
No
Yes
No
Yes
  • For the first question, 7times49=3437 \\times 49 = 343 is a cubic number.
  • For the second question, 49times30=147049 \\times 30 = 1470 is not a cubic number.
  • For the third question, 11 is a cubic number.
  • For the fourth question, 15times8times6times10=720015 \\times 8 \\times 6 \\times 10 = 7200 is not a cubic number.
  • For the fifth question, $30 \\times 1 \\times 15 \\times 8 \\times 6 \\times 10 = 216000$ is a cubic number.