- Time limit: 1.00 s
- Memory limit: 512 MB
Consider a game with players and chairs. The chairs will be arranged in a circle, and each player will sit on a chair. There is also a bell which will ring some number of times during the game.
Each chair has an integer between and : the number of steps the player who sits on that chair must move clockwise when the bell rings. A chair arrangement is valid if each chair will have exactly one player after the bell rings.
Your task is to find a valid chair arrangement or state that there is no such arrangement.
Input
The first line has an integer : the number of tests.
After this, each test consists of two lines. The first line has an integer . The second line has integers : the numbers on the chairs.
Output
For each test, first print YES
if there is a valid chair arrangement and NO
otherwise. If the answer is YES
, also print a possible arrangement clockwise. If there are several valid arrangements, you can print any of them.
Constraints
- for
Example
Input:
3 4 1 1 1 1 4 1 1 1 2 5 4 1 2 1 2
Output:
YES 1 1 1 1 NO YES 2 4 1 1 2
Subtask 1 (8 points)
Subtask 2 (5 points)
- if (i.e. each value is distinct)
Subtask 3 (4 points)
- for
Subtask 4 (7 points)
- for
Subtask 5 (12 points)
- for
Subtask 6 (15 points)
- for
Subtask 7 (20 points)
Subtask 8 (29 points)
- No restrictions.