Aibohphobia

Time limit: 0.7s Memory limit: 256MB Input: Output:

It's not a situation, it's a condition. Electromagnetic Hypersensitivity. For reasons unknown, my nervous system has become sensitized to certain frequencies of electromagnetic radiation.

  • Chuck McGill, Better Call Saul

Chuck McGill suffers from electromagnetic hypersensitivity: he is afraid of electricity. But did you know he is also afraid of palindromes?

Once he received a string ss as a birthday present from Jimmy. He wants to rearrange its symbols, obtaining string tt, so that the following condition holds:

  • For every i=2,3,,si = 2, 3, \ldots, |s|, string t1t2tit_1t_2\ldots t_i is not a palindrome.

Can you help him?

As a reminder, a string ss is called a palindrome, if it reads the same backwards as forwards. For example, aibohphobia is a palindrome.

Input data

The first line contains a single integer tt (1t1051 \le t \le 10^5) - the number of test cases. The description of test cases follows.

The only line of each test case contains a string ss, consisting of lowercase Latin letters.

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

Output data

For each test case, if there is no such way to rearrange characters of ss, print NO.

Otherwise, print YES. On the next line output a single string tt. It should be the rearrangement of characters of ss, and it should satisfy the condition from the statement.

You can print YES and NO in any case (e.g. the strings yEs, yes, Yes will be taken as a positive answer).

Example

stdin

5
a
sos
abba
icpc
tenet

stdout

YES
a
YES
oss
NO
YES
icpc
YES
tente

Log in or sign up to be able to send submissions!