Random Number Check

For each of N numbers decide whether no digit repeats four times in a row and every divisor greater than 1 exceeds K.

Medium4MathNumber theoryStringBrute forceNo attempts yetTime limit1sMemory limit64 MB

Problem

Mr. Random supplies random numbers to the people who come to him. Producing a large amount of random numbers by hand is hard, so he decided to use a random number generator.

The generator produces a few million numbers per second. Some of the numbers it produces do not look random to Mr. Random, so he has to filter every generated number.

A number is random when it satisfies both of the following conditions.

  1. No digit appears more than 3 times in a row.
  2. Every divisor of the number other than 1 is greater than KK.

For example, when KK is 2, the numbers 1112233445, 111333555 and 111 are random. The number 122221 is not random because the digit 2 appears 4 times in a row, and 1234 is not random because 2 divides 1234 and 2 is not greater than KK.

The number 1 has no divisor other than 1, so it satisfies the second condition.

Write a program that decides whether a number is random.

Input

The first line contains two integers NN and KK. (1N100001 \le N \le 10000, 1<K<2311 < K < 2^{31})

Each of the next NN lines contains one positive integer. Every given positive integer is smaller than 2322^{32}.

Output

Print NN lines. On each line print YES if the corresponding number is random, and NO otherwise.

Hint

In the sample, KK is 5.

  • 3 is not random because the divisor 3 is not greater than KK.
  • 10 is not random because the divisors 2 and 5 are not greater than KK.
  • 7 is random because the divisor 7 is greater than KK and no digit appears twice in a row.
  • 7777 is not random because the digit 7 appears 4 times in a row.
  • 121 is random because the divisors 11 and 121 are both greater than KK.