Oscar's Round Must Have a Constructive Problem

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Grammy has a sequence AA of length nn.

Please find a permutation PP such that P_iA_iP\_i \neq A\_i for all ii.

입력

There are multiple test cases.

The first line contains a single integer TT (1T100,0001 \leq T \leq 100\\,000), denoting the number of test cases.

For each test case:

The first line contains a single integer nn (1n100,0001 \leq n \leq 100\\,000).

The second line contains nn integers A_1,A_2,,A_nA\_1,A\_2,\ldots,A\_n (1A_in1 \leq A\_i \leq n).

It is guaranteed that the sum of nn does not exceed 500,000500\\,000.

출력

For each test case:

If the permutation does not exist, output "NO" on a single line.

Otherwise, output "YES" one the first line, then output nn integers one the second line, denoting the permutation P_1,P_2,,P_nP\_1,P\_2,\ldots,P\_n.