A Swyper keyboard is a keyboard for touch screen phones. Instead of tapping every letter of the word you want to type, you draw a single poly-line made of one or more connected segments.
The keyboard in this problem has four rows of square keys. Every key is a square of width 1 and height 1, and the center of every key is a point with integer coordinates. The coordinate x grows to the right and the coordinate y grows downward.
| x=−1 | x=0 | x=1 | x=2 | x=3 | x=4 | x=5 | |
|---|---|---|---|---|---|---|---|
| y=0 | A | B | C | D | E | F | |
| y=1 | G | H | I | J | K | L | |
| y=2 | M | N | O | P | Q | R | S |
| y=3 | T | U | V | W | X | Y | Z |
The two upper rows hold six keys each and run from x=0 to x=5. The two lower rows hold seven keys each and run from x=−1 to x=5.
This keyboard does not behave exactly like the popular real one, so do not assume anything that this statement does not say.
A poly-line is written as a string of two or more upper case English letters in which no two consecutive letters are equal. The line starts at the center of the first letter and then goes to the center of each following letter in turn. The string ACM stands for the line that starts at the center of A, goes to the center of C, and then goes to the center of M.
Such a line also passes over other keys. Between A and C it passes over B, and between C and M it passes over B, then H, then G, then N. Writing down every key the line passes over, in order, gives the expansion of the poly-line, which is ABCBHGNM for this example. When you draw this line you may mean any word that is a subsequence of the expansion, so ACM, BGN, ABCBHGNM and every other subsequence are possible.
A string X is a subsequence of a string Y when X can be obtained by deleting zero or more letters from Y without changing the order of the remaining letters.
You are given a dictionary of one or more words and the string of a poly-line. Find a word in the dictionary that the poly-line may mean.
A line that runs along the boundary of a key without entering it does not pass over that key. The segment from A to H passes over neither B nor G.
The first line contains one integer T, the number of test cases (1≤T≤100).
Each test case starts with a line holding an integer N and a string P separated by one space (1≤N≤1000), the number of words in the dictionary and the string of the poly-line. Each of the next N lines holds one word of the dictionary.
Every string in the input consists of at least 2 and at most 100 upper case English letters from A to Z.
The string of the poly-line describes only its segments, so it need not list every key the line passes over. One poly-line may pass over the same key more than once, even though two consecutive letters of a poly-line are never equal.
For each test case print one line. Print the first word of the dictionary, in the order the words are given, that is a subsequence of the expansion of the given poly-line. Print NO SOLUTION if no word of the dictionary is a subsequence of that expansion.