Many acronyms are spelled with the same letters but mean different things. ISS can mean International Space Station, In School Suspension, or Interstate Sporadic Squabbles. It cannot mean Institutional Saliva Tester, which shortens to IST, and it cannot mean Intermural Sports Situational Comedies, which shortens to ISSC.
A phrase fits an acronym when it has exactly as many words as the acronym has letters, and the first letter of each word is the letter at the same position in the acronym. Every word begins with a capital letter.
Given an acronym and a list of candidate phrases, find the phrases that fit the acronym.
The first line contains the number of data sets, which is at most 10.
The first line of each data set contains the acronym and the number of candidate phrases, separated by a space. The number of candidate phrases is at most 10. Each of the following lines contains one candidate phrase.
For each data set, print the acronym on its own line, then print every phrase that fits the acronym, one per line, in the order the phrases were given. If no phrase fits, print only the acronym.