


1) The character ‘C’ is a lowercase English alphabet that is given as input.
2) For example, if the character is 'C' is "d" then, the alphabetical order starts with "d" will look like {d,e,f,....,y,z,a,b,c}.
3) Every string in the array consists of only lowercase English alphabets.
The first line contains an integer 'T', which denotes the number of test cases or queries to be run. Then, the 'T' test cases follow.
The first line of each test case contains a positive integer 'N' denoting the size of the array and a character 'C', as described in the problem statement.
The second line of each test case contains a sequence of 'N' space-separated strings denoting the elements of the array.
For each test case, print in a new line a sequence of 'N' space-separated strings after sorting according to the new alphabetical order given in the problem.
Output for each test case will be printed in a separate line.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 100
1 <= N <= 1000
'C' is a lowercase English alphabet.
1 <= | ARRSTR[i] | <= 9, where 1 <= i <= N.
Time Limit: 1sec
Suppose that we are comparing two strings of ‘ARRSTR[]’ named ‘X’ and ‘Y’. Let us assume that we have found the first different character at the ith index, so if the order (already stored in the HashMap) of ‘X[i]’ is less than the ‘Y[i]’, then ‘X’ is to placed in the front of ‘Y’ (not necessarily adjacent to ‘Y’), and vice-versa.
Algorithm is as follows:
bool compare(string x, string y) :