PROGRAMMING:Xiao Ming's search
###Topic background
Xiao Ming has been sleeping every day in class recently, so he can't do anything.
One day, the teacher finally asked him to answer the question. Can you help him through the difficulty?
Now the teacher gave Xiaoming n strings composed of 0 and 1, and then asked m times,
Each query gives a string composed of 0 and 1,
Xiao Ming needs to find the longest prefix string that matches the current string in the first n strings.
If there are multiple strings with the longest prefix, find the one with the smallest dictionary order.
If Xiao Ming can't find out, Xiao Ming will be gone. Can you help Xiao Ming?
###Input format:
The first line of input is an integer T, indicating that there are t groups of test cases.
For each group of inputs:
The first line of input contains an integer n, which means that there are n lines to follow.
Next, N lines, 1 string for each line, and the string is only composed of 0 and 1.
The next line has an integer m for the number of queries.
Next, m lines, 1 string per line, and the string is only composed of 0 and 1.
For each query, you need to find the string with the longest matching prefix. If there are multiple answers, please output the one with the smallest dictionary order.
###Output format:
For each group of inputs:
Output a total of M lines, each line of a string corresponding to the answer.
###Input example:
```in
two
five
0100
0101
011
ten thousand one hundred and ten
ten thousand one hundred and eleven
one
ten million eleven thousand and eleven
four
01
one thousand and one
one million eleven thousand and one hundred
00110
two
one hundred thousand and eleven
01100
```
###Output example:
```out
ten thousand one hundred and ten
one thousand and one
01
```
answer:If there is no answer, please comment
Xiao Ming has been sleeping every day in class recently, so he can't do anything.
One day, the teacher finally asked him to answer the question. Can you help him through the difficulty?
Now the teacher gave Xiaoming n strings composed of 0 and 1, and then asked m times,
Each query gives a string composed of 0 and 1,
Xiao Ming needs to find the longest prefix string that matches the current string in the first n strings.
If there are multiple strings with the longest prefix, find the one with the smallest dictionary order.
If Xiao Ming can't find out, Xiao Ming will be gone. Can you help Xiao Ming?
###Input format:
The first line of input is an integer T, indicating that there are t groups of test cases.
For each group of inputs:
The first line of input contains an integer n, which means that there are n lines to follow.
Next, N lines, 1 string for each line, and the string is only composed of 0 and 1.
The next line has an integer m for the number of queries.
Next, m lines, 1 string per line, and the string is only composed of 0 and 1.
For each query, you need to find the string with the longest matching prefix. If there are multiple answers, please output the one with the smallest dictionary order.
###Output format:
For each group of inputs:
Output a total of M lines, each line of a string corresponding to the answer.
###Input example:
```in
two
five
0100
0101
011
ten thousand one hundred and ten
ten thousand one hundred and eleven
one
ten million eleven thousand and eleven
four
01
one thousand and one
one million eleven thousand and one hundred
00110
two
one hundred thousand and eleven
01100
```
###Output example:
```out
ten thousand one hundred and ten
one thousand and one
01
```
answer:If there is no answer, please comment