Joe is learning to speak

No attempts yetTime limit3sMemory limit128 MB

Problem

Joe is four years old and he is learning his mother tongue. He first tried to memorize every possible sentence, then he realized that the number of different sentences has no limit. So he decided to memorize only the phrases of length at most nn and their meaning. A phrase of length kk is a block of kk words that appear consecutively in one sentence.

Joe fully understands a sentence when he has already memorized every phrase of length at most nn that occurs in it.

Every afternoon Joe reads sentences one by one. He remembers everything he learned on the previous days. After reading a sentence he asks for the meaning of each word he does not know and learns it. If he still does not fully understand the sentence, he asks for the meaning of the whole sentence. Then he memorizes every phrase of length at most nn that occurs in that sentence and moves on to the next one.

For example, let n=2n = 2 and suppose Joe already knows "I live in a house" and "This is a green house". He fully understands "I live in a green house", because he already knows all its phrases of length 1 and 2. With n=3n = 3 he asks for the meaning of the whole sentence, because "in a green" does not occur consecutively in either of the two earlier sentences.

Joe always knows his own name Joe.

Input

The input contains several test cases. The first line of a case holds the maximum phrase length nn (2n52 \le n \le 5) that Joe can memorize.

The lines that follow hold the sentences Joe memorized on the previous days. This part ends with a line that holds only the character *. After the *, the sentences Joe reads today follow, and that part ends with a line that holds only the character #.

Each part contains at most 20000 different words. The end of a sentence is marked with one of . , : ; ? ! and that character always appears as a separate token surrounded by whitespace. If a part ends while words are still pending with no end mark, those words form one more sentence. Two end marks in a row do not create an empty sentence, and a part may contain no sentence at all.

A word has length at most 20, a sentence has at most 100 words, and a part has at most 1000 sentences. The same sentence may appear more than once. A sentence may span several lines, and one line may hold several sentences.

Words consist of roman letters only. Apart from the sentence end marks, no digits or other symbols appear. Two words that differ only in letter case are the same word, so Joe, JOE and joE are all the same word.

The input ends at end of file.

Output

For each test case, first print a line with the text Learning case C, where C is the number of the case starting from 1. Print one blank line between the outputs of two neighbouring cases.

Process today's sentences in order. For every word W that Joe does not know, print What does the word "W" mean? on its own line, in the order of first occurrence inside that sentence, and never ask twice for the same word in one sentence. If Joe still does not fully understand the sentence S after learning its words, print What does the sentence "S" mean?

Print W and S with the same letter case they have in the input, and separate the words of S with exactly one space. Print nothing for a sentence that Joe fully understands.