Limits 1.5s, 512 MB

Rakib loves to play with words and numbers. Currently He invented a game where he wrote down some words into paper and converted those words into numbers. Conversion process is very simple. He used the alphabetic position of a character to convert character into number. There are 26 letters in English. The position of ‘a’ is 1 and ‘z’ is 26th.  For example if he has a word “hi”, then the number value of this word is 17 ( the position of ‘h’ in alphabetic serial is 8 and the position of ‘i’ is 9). Now he guesses a number and checks if using any 4 words he can match the number by using all unique numbers in the quadruplets. For example, the world lists he wrote are: “hi”, “hello”, “me”, “he”, “how”, “what”. So the number value of those words are: 17, 52, 18, 13, 46, 52 accordingly. And The guessed number is 100. So he can actually make the number by using 17+52+18+13 = 100

Input

Input starts with a line having positive number T (1 <= T <= 100 ) which indicates the number of test cases. Each test case starts with a positive number N (4 <= N <= 1000), which indicates the number of total words and a Positive number G (0<= G <= 10^9), which indicates the guessed number . The next N lines contain N words W(1 <= length(W)<= 100). The words contain only the alphabet in small letters.

Output

For each test case you should print “YES” if he can make the number otherwise print “NO”

Sample

InputOutput
1
6 100
hi
hello
me
he
how
what
CASE 1: YES

Submit

Login to submit.

Statistics

75% Solution Ratio
C183067Earliest, Sep '21
mfctanzimFastest, 0.0s
mfctanzimLightest, 5.5 kB
mustafiz_voidShortest, 945B
Toph uses cookies. By continuing you agree to our Cookie Policy.