The Enterprise has reached a planet that was inhabited at some point in the past. All the earlier civilization left behind is a set of texts the crew recovered. Working from a small set of keywords collected in several different languages, the crew wants to work out what kind of beings lived there.
The first line contains N (1≤N≤100), the number of known languages. Each of the next N lines contains the name of a language followed by one or more keywords in that language, separated by spaces. A blank line follows. After the blank line comes a series of lines, each written in one language, and you have to decide which language each of them is.
Words and the names of languages are uninterrupted strings of upper or lowercase ASCII letters, apostrophes, or hyphens. No word appears in more than one language.
No line is longer than 256 characters. There are at most 1000 lines of sample text.
Every sample text contains at least one keyword from one of the languages, and no sample text contains keywords from two different languages. A sample text may also contain punctuation (commas, periods, exclamation points, semicolons, question marks, and parentheses) and spaces, all of which separate keywords. A sample text may contain words that are not keywords of any language.
Keywords are matched without regard to case.
For each line of sample text after the blank line, print the name of the language the text is written in, one name per line.