The alphabet of a certain alien language consists of n distinct symbols. The symbols are like the letters of English alphabet but their ordering is different. You want to know the original order of the symbols in that particular alphabet. You have a string consists of all the letters of that alphabet and you know that this is the k-th (1 based) lexicographic permutation of these symbols. You have to arrange these symbols in lexicographic order of that language.
Input
The first line of input will contain an integer T (T ≤ 5000) which denotes the number of test cases. Each of the following T lines contains a string s and an integer k. The string will be of length n (1 ≤ n ≤ 20) and will consist of lowercase letters only. All the letters in the string will be distinct. The value of k will be in the range (1 ≤ k ≤ n!).
Output
For each line of input output the case number and a string which contains the letters in lexicographic order in that language.
Sample Input
3 bdac 11 abcd 5 hjbrl 120
Output for Sample Input
Case 1: abcd Case 2: acdb Case 3: lrbjh
Note
The first input resembles the original order of English alphabet. Here are the lexicographic permutations:
abcd | 1 | cabd | 13 |
abdc | 2 | cadb | 14 |
acbd | 3 | cbad | 15 |
acdb | 4 | cbda | 16 |
adbc | 5 | cdab | 17 |
adcb | 6 | cdba | 18 |
bacd | 7 | dabc | 19 |
badc | 8 | dacb | 20 |
bcad | 9 | dbac | 21 |
bcda | 10 | dbca | 22 |
bdac | 11 | dcab | 23 |
bdca | 12 | dcba | 24 |