You are given a number, . The devil wants his share of the number. He will take the largest subnumber with digits. Minimize the devil’s share by reordering the digits in number .
Task
Formally, you have at your disposal digits between and , inclusively. Given an integer , you are to create a number using all the digits at your disposal, such that the largest length substring of is as small as possible.
Input data
The first line of input contains one integer - the number of test scenarios to analyse.
The description of test scenarios follows. Each test scenario consists of two lines:
- The first line contains one integer - the length of all the substrings to consider.
- The second line contains space-separated integers: , where represents the number of digits at your disposal.
Output data
For each test scenario, print - the number you created, on a separate line.
If there are several numbers with the same smallest possible length substring you can output any of them.
Constraints and clarifications
- A length substring of is a base integer comprising of consecutive digits of in the very same order. There are such substrings in number .
# | Points | Restrictions |
---|---|---|
1 | 13 | , scenarios will not repeat |
2 | 14 | |
3 | 29 | |
5 | 44 | No further restrictions. |
Example
stdin
3
2
1 1 2 0 0 0 0 0 0
7
2 4 2 0 0 6 2 2 2
7
3 3 3 0 0 6 2 2 2
stdout
2313
62616236261623778899
623616236162361778899
Explanation
There are three test scenarios to consider in the example.
In the first scenario and you have to arrange digits .
One optimal is , with the following length substrings: and , the largest being . No other has a smaller largest length substring.
Another optimal would be , since its largest length substring is also .
In the second scenario and you have to arrange digits .
One optimal is with the largest length substring .
In the third scenario and you have to arrange digits .
One optimal is with the largest length substring .