Akhil and his girlfriend
/

## Easy-Medium

Problem
Editorial
Analytics

Akhil was writing a love letter to his girlfriend Sapna. But while writing the letter he was called by his mother. In the meantime, his brother transformed all occurrences of some letter to some other letter in a particular order.

For example - If the original string is "abca". He first changes 'a'->'d', string becomes "dbcd", then changes 'b'->'t', the string becomes "dtcd".

After much scolding by Akhil, his brother reveals the alphabet transformations (in that order).

Also his brother claims that no occurence of final letter was present during the change. For example, if he changes 'a' to 'b', then no 'b' was present in the string just before the change.

Is the claim true?

Input Format:-
First line will contain T, i.e. number of test cases. First line of every test case will contain a lower-case string s, which is the string after the transformations. Second line of every test case will contain an integer M. Next M will contain two space-separated characters each, representing the original character and new character respectively.

Output Format:-
Output in new line for every test case, "Yes" if the claim is true, else "No" .

Constraints:-
1 ≤ T ≤ 10
1 ≤ length of string (S) ≤ $10^{4}$
1 ≤ M$10^{4}$

SAMPLE INPUT
3
tact
4
a d
b k
k a
d t
kaak
4
a k
b c
c d
d a
attat
3
c k
b k
k t
SAMPLE OUTPUT
Yes
Yes
No
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

## This Problem was Asked in

Initializing Code Editor...

?