#P1478B. Nezzar and Lucky Number
Nezzar and Lucky Number
Description
Nezzar's favorite digit among is . He calls a positive integer lucky if occurs at least once in its decimal representation.
Given integers , for each Nezzar would like to know if can be equal to a sum of several (one or more) lucky numbers.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and (, ).
The second line of each test case contains integers ().
For each integer in each test case, print "YES" in a single line if can be equal to a sum of lucky numbers. Otherwise, print "NO".
You can print letters in any case (upper or lower).
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers and (, ).
The second line of each test case contains integers ().
Output
For each integer in each test case, print "YES" in a single line if can be equal to a sum of lucky numbers. Otherwise, print "NO".
You can print letters in any case (upper or lower).
Samples
Note
In the first test case, , itself is a lucky number, cannot be equal to a sum of lucky numbers.