The first line of the input gives the number of test cases T; T test cases follow.
Each test case contains two integer N and Q, The number of words in the dictionary, and the number of words in the list.
Next N line, each line has a string Wi, represents the ith word in the dictionary ($0 < |Wi| \leq 100000$)
Next Q line, each line has two string Pi , Si, represents the prefix and suffix of the ith word in the list ($0 < |Pi|,|Si| \leq 100000, 0 < |Pi|+|Si| \leq 100000$)
All of the above characters are lowercase letters.
The dictionary does not contain the same words.
Limits
$T \leq 5$
$0 < N,Q \leq100000$
$\sum{Si +Pi} \leq 500000$
$\sum{Wi} \leq 500000$