CF1971B.Different String

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Different String

You are given a string ss consisting of lowercase English letters.

Rearrange the characters of ss to form a new string rr that is not equal to ss, or report that it's impossible.

Input

The first line contains a single integer tt (1t10001 \leq t \leq 1000) — the number of test cases.

The only line of each test case contains a string ss of length at most 1010 consisting of lowercase English letters.

Output

For each test case, if no such string rr exists as described in the statement, output "NO" (without quotes).

Otherwise, output "YES" (without quotes). Then, output one line — the string rr, consisting of letters of string ss.

You can output "YES" and "NO" in any case (for example, strings "yEs", "yes", and "Yes" will be recognized as a positive response).

If multiple answers are possible, you can output any of them.

Note

In the first test case, another possible answer is forcescode.

In the second test case, all rearrangements of aaaaa are equal to aaaaa.

Samples

8
codeforces
aaaaa
xxxxy
co
d
nutdealer
mwistht
hhhhhhhhhh
YES
forcodesec
NO
YES
xxyxx
YES
oc
NO
YES
undertale
YES
thtsiwm
NO

在线编程 IDE

建议全屏模式获得最佳体验