Limits 1s, 512 MB

Joy is a programmer. He likes to learn various programming languages. He has already learned many programming languages and always uses these in his ACM programming problem solving. Recently, an idea has come into his mind. He wants to make a programming language of his own which will be very user friendly and logically easier for a beginner programmer. And so he wants to follow some of the already existed programming languages. But he is confused about choosing the languages that he will follow to make the new one! For that reason, he wants a solution from his elder brother Joly. But, Joly is very busy now-a-days. So, Joly asked you to help Joy. Joly told you to follow at most 3 languages those are lexicographically(ASCII value-based) higher than the new programming language and the lexicographical difference between the name of those languages should be as minimum as possible from Joy's new programming language.

Now, your task is to help Joy to find the solution by picking up the programming language/languages to make the new programming language. You can assure that Joy knows a lot of different programming languages.

Input

In the first line, take an integer T (1 <= T <= 3), denoting the number of testcases. In the next line take a string S (1<= S.len <= 10 ), denoting the name of the new language (S can contain both Uppercase and Lowercase letters and 0-9 numbers) and an integer N (2 <= N <= 7), denoting the number of usable languages. In the next line take N numbers of string.

Output

For each case, output the case number and at most 3 languages which should be lexicographically sorted. If no one is followed then print "No one is suitable".

Sample

InputOutput
2
Lup 5
Java Python Ruby C R
SYl 3
C++ Perl C#
Case #1: Java Python Ruby
Case #2: Perl

HINT : In the first case, the new programming language is Lup. And the given languages are Java, Python, Ruby, C, R. So you can select at most 3 of 5. The total ascii value of Lup is 76+117+112 = 305. And Java = 74+97+118+97 = 386, as like this Python = 642, Ruby = 418, C = 67 and R = 82. So you can take Java, Python and Ruby (These are sorted).

Submit

Login to submit.

Statistics

66% Solution Ratio
tvirussustEarliest, Jul '17
subhashis_cseFastest, 0.0s
Onik123Lightest, 0 B
ariful_luShortest, 748B
Toph uses cookies. By continuing you agree to our Cookie Policy.