A cookie maker has put its letter cookies back on sale. They are as much fun to play with as to eat. Your little sister is making words out of the letters she finds in the box, and you want to decide before she does whether a word can be made.
Given the letters in a cookie box, decide for each word your sister knows how to spell whether she can spell it. After she finishes a word she scrambles the cookies back into the box, so the same cookies are available again for the words that follow.
The first line contains T, the number of letter cookie boxes your sister has. Each box starts with a line listing all the letters in that box, in no particular order. Then comes a line with W, the number of words she would like to spell, followed by the W words, one per line.
For each word, print one line containing YES if the word can be spelled, or NO if it cannot.