#P1975H. 378QAQ and Core

378QAQ and Core

Description

378QAQ has a string ss of length nn. Define the core of a string as the substring^\dagger with maximum lexicographic^\ddagger order.

For example, the core of "bazoka\mathtt{bazoka}" is "zoka\mathtt{zoka}", and the core of "aaa\mathtt{aaa}" is "aaa\mathtt{aaa}".

378QAQ wants to rearrange the string ss so that the core is lexicographically minimum. Find the lexicographically minimum possible core over all rearrangements of ss.

^\dagger A substring of string ss is a continuous segment of letters from ss. For example, "defor\mathtt{defor}", "code\mathtt{code}" and "o\mathtt{o}" are all substrings of "codeforces\mathtt{codeforces}" while "codes\mathtt{codes}" and "aaa\mathtt{aaa}" are not.

^\ddagger A string pp is lexicographically smaller than a string qq if and only if one of the following holds:

  • pp is a prefix of qq, but pqp \ne q; or
  • in the first position where pp and qq differ, the string pp has a smaller element than the corresponding element in qq (when compared by their ASCII code).

For example, "code\mathtt{code}" and "coda\mathtt{coda}" are both lexicographically smaller than "codeforces\mathtt{codeforces}" while "codeforceston\mathtt{codeforceston}" and "z\mathtt{z}" are not.

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051\leq t\leq 10^5). The description of the test cases follows.

The first line of each test case contains a single integer nn (1n1061\leq n\leq 10^6) — the length of string ss.

The next line of each test case contains the string ss of length nn. The string ss consists of lowercase English letters.

It is guaranteed that the sum of nn over all test cases does not exceed 10610^6.

For each test case, output the lexicographically minimum possible core over all rearrangements of ss.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1051\leq t\leq 10^5). The description of the test cases follows.

The first line of each test case contains a single integer nn (1n1061\leq n\leq 10^6) — the length of string ss.

The next line of each test case contains the string ss of length nn. The string ss consists of lowercase English letters.

It is guaranteed that the sum of nn over all test cases does not exceed 10610^6.

Output

For each test case, output the lexicographically minimum possible core over all rearrangements of ss.

Sample Input 1

6
3
qaq
4
cccc
6
bazoka
6
zazzzz
7
ababbbb
7
ccbabcc

Sample Output 1

qaq
cccc
z
zzz
bbababb
cbcacbc

Note

In the first test case, all possible rearrangements and their corresponding cores are as follows:

  • "qaq\mathtt{qaq}", its core is "qaq\mathtt{qaq}".
  • "aqq\mathtt{aqq}", its core is "qq\mathtt{qq}".
  • "qqa\mathtt{qqa}", its core is "qqa\mathtt{qqa}".

So the core with the minimum lexicographic order in all rearrangement plans is "qaq\mathtt{qaq}".