#P0285. LRC and VIP
LRC and VIP
题目描述
You have an array of size
You need to divide the n elements into sequences and , satisfying the following conditions:
Each element belongs to exactly one sequence. Both sequences and contain at least one element. ∗
* denotes the greatest common divisor of integers and .
输入格式
Each test contains multiple test cases. The first line contains the number of test cases . The description of the test cases follows.
The first line of each test case contains an integer
The second line of each test case contains integers
输出格式
For each test case, first output Yes
if a solution exists or No
Only when there is a solution, output
integers on the second line. The number should be either 1
or 2
. 1
represents that the element belongs to sequence B
and 2
represents that the element belongs to sequence C
.
You should guarantee that 1
and 2
both appear at least once.
输入样例:
3
4
1 20 51 9
4
5 5 5 5
3
1 2 2
输出样例:
Yes
2 2 1 1
No
Yes
1 2 2