URI Online Judge | 1507

Subsequences

By Rigel Bezerra de Melo, Universidade Federal de Campina Grande BR Brazil

Timelimit: 2

Given two sequences, decide if the later is a subsequence of the first one.

Input

Input starts with an integer N (0 < N <= 10), representing the number of test cases. Then there are the description of the N test cases. Each test case starts with a sequence S (S in [a-zA-Z], 0 < |S| < 100000) and an integer Q (0 < Q <= 1000), the number of queries. The next Q lines describes each the second sequence R (R in [a-zA-Z], 0 < |R| < 100).

Output

For each querie R, print "Yes" (no quotes) if R is a subsequence of S, or "No" (no quotes) otherwise.

Sample Input Sample Output

1
aabccbba
2
abc
abbc

Yes
No