Given an array of numbers and a non-negative integer you have to sort the array in such a way so that the absolute difference between every adjacent element is no more than .
For example if you have an array and then one possible solution will be where and the absolute difference between every adjacent elements are no more than 2.
If there is many solution you have to print the lexicographically smallest answer. If there are no solution just print .
Input will start with a positive integer () denoting the number of test cases.
Each test case will have two positive integer () denoting the number elements in the array and ().
The next line will have space separated integers representing the array ().
For each test case if there is a solution print the lexicographically smallest sorted array. You have to print space separated integers without any leading or trailing spaces. If there are no solutions, print .
Input | Output |
---|---|
2 2 2 3 1 2 1 1 3 | 1 3 No Solution |