题目描述
Problem description
Nineteen years after the conclusion of events of Harry Potter and the Deathly Hallows, Harry Potter is now a Ministry of Magic employee. His youngest son Albus Severus Potter struggle with the weight of a family legacy he never wanted. As past and present fuse ominously, both father and son learn the uncomfortable truth: sometimes, darkness comes from unexpected places.
Now to overcome the darkness, Albus Severus Potter and Harry Potter have to create a potion from the available 'N' ingredients. Potion and list of ingredients is given. You have to tell if it is possible to make the potion or not.
Input
First line contains number of test cases.For each test caseFirst line : a string, describing the potion.Second line : an integer(N), the number of ingredients available.Next 'N' line contain the one string each. Each string denotes a separate ingredientAll strings are in lowercase.
Output
If the potion can be made, print "YES" else print "NO" (without quotes).Print result for each test case in a new line.
Constraints
SubTask 1 - 70 Points
1 ≤ T ≤ 10
1 ≤ length(potion) ≤ 10^3
1 ≤ N ≤ 100
1 ≤ length(ingredient) ≤ 100
SubTask 2 - 30 Points
1 ≤ T ≤ 5
1 ≤ length(potion) ≤ 10
1 ≤ N ≤ 10
1 ≤ length(ingredient) ≤ 10
Example
Input:
3
abccde
2
acd
bc
abccde
2
ad
bce
mnopq
3
amn
opsp
qrwas
Output:
NO
NO
YES
Explanation
Test Case 1
There is no 'e' in ingredients
Test Case 2
There is only one 'c' in ingredients
Test Case 3
Everything required is in ingredients
输入格式
见题面
输出格式
见题面