Bhai Bhai

0

0 votes
Easy
Problem

Not everyone probably knows that prince has younger brother manmeet. Currently manmeet learns to read.

He knows some subset of the letter of Latin alphabet. In order to help manmeet to study, prince gave him a book with the text consisting of N words. manmeet can read a word if it consists only of the letters he knows.

Now prince is curious about which words his brother will be able to read, and which are not. Please help him!

 

Input:

The first line of the input contains a lowercase Latin letter string S, consisting of the letters manmeet can read. Every letter will appear in S no more than once.

The second line of the input contains an integer N denoting the number of words in the book.

Each of the following N lines contains a single lowecase Latin letter string Wi, denoting the ith word in the book.

 

Output:

For each of the words, output "Yes" (without quotes) in case manmeet can read it, and "No" (without quotes) otherwise.

 

Constraints:

  • 1 ≤ |S| ≤ 26
  • 1 ≤ N ≤ 1000
  • 1 ≤ |Wi| ≤ 12
  • Each letter will appear in S no more than once.
  • S, Wi consist only of lowercase Latin letters.
Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?