Obviously, some of the descriptions are deliberately lengthened, in order to make the whole paragraph more fun. In this problem, your task is similar: given a set of rules, find a description that is at least A characters and at most B characters long. If there are more than one possible description satisfying the condition above, choose the one that comes first lexicographically. Note that shorter answers are NOT always better than longer ones.
BTW: Rules like "Lixiaoyao: Lixiaoyao" looks rather stupid, so don't print things like that, even if no other solutions can be found.
Input
The first line contains a single integer T (T <= 10), the number of test cases. Each case begins with an integer n (1 <= n <= 5), the number of rules, followed by n lines, each describing a rule. Each rule begins with the character's name, then a colon, then a single space, and the description. The description is a list of tokens separated by a single space, with no leading spaces or trailing spaces, followed by a period. Each token is either a word consisting of only lowercase letters, or a character's name, or a character's name, followed by an apostrophe('), then a lowercase letter 's'. A character's name is always an uppercase letter followed by zero or more lowercase letters. No two characters will have the same name, but not all character names appear in the left side of a rule. After the ruleset, you'll be given a single integer q (1 <= q <= 5) on the next line, indicating the number of queries. Each query appears on its own line, containing the name of the character in question, then two integers A and B (1 <= A <= B <= 100), explained above.
Each rule is at least 15 characters, at most 100 characters, containing at least one lowercase token. On the right side of each rule, there will be at most 3 characters involved, all distinct (though one of them may appear on the left side of the rule), and there are no more than 10000 different descriptions for any character in questions, if we only count descriptions only length <= B.
Output
For each test case, print the case number in the first line, then q answers in the following q lines, one for each line. If there is no solution, print 'No solution.' (without quote), otherwise a sentence describing the character. The sentence should be in the same format as a rule in the input. The length of the sentence (including everything: the character's name, the colon, the space, the description, and the final period) should be at least A and at most B.
Sample Input
2
2
Alice: Bob's mother.
Bob: Alice's son.
2
Alice 20 20
Bob 24 25
4
A: B's girlfriend.
B: A's boyfriend.
C: the only person who knows that A and B love each other.
A: D's smallest daughter.
5
A 1 100
C 1 50
C 70 80
C 71 80
C 82 90
Sample Output
Case 1:
Alice: Bob's mother.
Bob: Bob's mother's son.
Case 2:
A: A's boyfriend's girlfriend.
No solution.
C: the only person who knows that A and A's boyfriend love each other.
C: the only person who knows that B's girlfriend and B love each other.
C: the only person who knows that A and B's girlfriend's boyfriend love each other.