시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 64 MB169312115.217%

## 문제

Mr. Random's job is to supply random numbers for people who comes to him. Unfortunately, generating a massive amount of random numbers is very hard. So, Mr. Random has decided to get a random number generator to help him.

The random number generator can generate a few million random numbers under 1 second. But Mr. Random has noticed that some of the number generated by the random number generator does not seem random to him so he need to filter all the numbers generated.

For a number to be random it must satisfy both the following conditions:

1. The number can contain at most 3 consecutive repeated digit.
2. All factors of the number (except 1) must be greater than K.

For example, if K = 2, then 111223344551, 111333555777 and 111 are all random, while 122221 (digit 2 is consecutively repeated 4 times) and 1234 (2 is a factor of 1234, which is not greater than K) are both not random.

Your task is to write a program to help Mr. Random to determine whether a number is random or not.

## 입력

The first line of input contains two positive integers, N and K. The next N lines contain positive integers, one on each line. (1 ≤ N ≤ 10,000, 1 < K < 231)

The N positive integers are all less than 232. (Use unsigned int for storing the positive integers.)

## 출력

Output N lines. Each line should be YES if the corresponding number is a random number or NO if the number is not a random number.

## 예제 입력 1

5 5
3
10
7
7777
121


## 예제 출력 1

NO
NO
YES
NO
YES


## 힌트

In the example above, K = 5.

• 3 is not random because 3 is a factor that is not greater than K.
• 10 is not random because 2 and 5 are factors that are not greater than K.
• 7 is random because the factor 7 is greater than K and contains only 1 consecutive repeated digit.
• 7777 is not random because it contains 4 consecutive repeated digits.
• 121 is random because the factors 11 and 121 are both greater than K and contains only 1 consecutive repeated digit.