9027 - K Characters   

Description


Given a string, output all different possible set of K characters in the string.  And sort them in the dictionary order.  For example, if K=2 and the given string is ‘CDBABBD’, output

AB
AC
AD
BB
BC
BD
CD
DD

Input

The first line of input contains a positive integer t (t <= 30), which indicates the number of test cases.  For each case, there are one strings and a positive integer K in a line. The length of the string is less than 100 and strings contain only 'A'-'K'; The number K, less than or equal to 10, indicates the length of substrings.

Output

For each test case, output all different possible set of K characters in the string.  And sort them in the dictionary order, one substring per line.  Print a blank line after each test case.

Sample Input  Download

Sample Output  Download

Tags

9424



Discuss