Time Limit: 4000/2000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)
Give you a string S whose length is no more than 1000, and two operations.
Operation 1：read a string Str1，and add to S。S becomes S+str1
Operation 2：read a string Str2，and tell me whether it is a subsequence of S（not necessarily consecutive）
or the subsequence of S'，S' equals to S's shifting left（"bca"、"cab" all equals to "abc"'s shifting left)
The first line is an integer T(1<=T<=150) ，the number of test cases;
For each test case，
The first line is a string S(length <= 1000)
The second line is a positive integer M (1<=M<=100)
The follow M lines:
Command string (Command is 1 or 2，and the string's length <= 100)
All the strings only consist of lowercase letters
When operation 2 occurs，output "YES" if exists，otherwise "NO"
if S = "abc", STR = "ef", then S + STR is "abcef", also the strcat funtion in C