Consider an array A of size N. You start from the index 0 and your goal is to reach index N−1 in exactly M moves.
At any index, you can move forward or backward by a number of steps that is equal to a prime divisor of the value which exists at that index. You cannot go beyond the array while going forward or backward.
Write a program to determine whether it is possible to reach index N−1 in M moves.
Input format
Output format
For each test case, print YES or NO depending upon the result.
Constraints
1≤T≤10
2≤N≤40
1≤A[i]≤106
1≤M≤106
In testcase 1 you can directly jump from position 0 to position 2.