{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp class\u003d\"MsoNormal\"\u003eGiven a string of characters, we can permute the individual characters to make new strings. At first we order the string into alphabetical order. Then we start permuting it.\u003c/p\u003e \n \u003cp class\u003d\"MsoNormal\"\u003eFor example the string \u003cb\u003e\u0027abba\u0027\u003c/b\u003e gives rise to the following 6 distinct permutations in alphabetical order.\u003c/p\u003e \n \u003cp class\u003d\"MsoNoSpacing\"\u003e\u003cb\u003eaabb 1\u003c/b\u003e\u003c/p\u003e \n \u003cp class\u003d\"MsoNoSpacing\"\u003e\u003cb\u003eabab 2\u003c/b\u003e\u003c/p\u003e \n \u003cp class\u003d\"MsoNoSpacing\"\u003e\u003cb\u003eabba 3\u003c/b\u003e\u003c/p\u003e \n \u003cp class\u003d\"MsoNoSpacing\"\u003e\u003cb\u003ebaab 4\u003c/b\u003e\u003c/p\u003e \n \u003cp class\u003d\"MsoNoSpacing\"\u003e\u003cb\u003ebaba 5\u003c/b\u003e\u003c/p\u003e \n \u003cp class\u003d\"MsoNormal\"\u003e\u003cb\u003ebbaa 6\u003c/b\u003e\u003c/p\u003e \n \u003cp class\u003d\"MsoNormal\"\u003eGiven a string, you have to find the \u003cb\u003en\u003csup\u003eth\u003c/sup\u003e\u003c/b\u003e permutation for that string. For the above case \u003cb\u003e\u0027aabb\u0027\u003c/b\u003e is the 1\u003csup\u003est\u003c/sup\u003e and \u003cb\u003e\u0027baab\u0027\u003c/b\u003e is the 4\u003csup\u003eth\u003c/sup\u003e permutation.\u003c/p\u003e \n "}},{"title":"Input","value":{"format":"HTML","content":" \n \u003cp class\u003d\"MsoNormal\"\u003eInput starts with an integer \u003cb\u003eT (\u003c/b\u003e\u003cb\u003e≤ 200)\u003c/b\u003e, denoting the number of test cases.\u003c/p\u003e \n \u003cp class\u003d\"MsoNormal\"\u003eEach case contains a non empty string of lowercase letters with length no more than \u003cb\u003e20\u003c/b\u003e and an integer \u003cb\u003en (0 \u0026lt; n \u0026lt; 2\u003csup\u003e31\u003c/sup\u003e)\u003c/b\u003e.\u003c/p\u003e \n "}},{"title":"Output","value":{"format":"HTML","content":" \n \u003cp class\u003d\"MsoNormal\"\u003eFor each case, output the case number and the \u003cb\u003en\u003csup\u003eth\u003c/sup\u003e\u003c/b\u003e permutation. If the \u003cb\u003en\u003csup\u003eth\u003c/sup\u003e\u003c/b\u003e permutation doesn\u0027t exist print \u003cb\u003e\u0027Impossible\u0027\u003c/b\u003e.\u003c/p\u003e \n "}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e3\naabb 1\naabb 6\naabb 7\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase 1: aabb\nCase 2: bbaa\nCase 3: Impossible\u003c/pre\u003e"}}]}