#P1894B. Two Out of Three

    ID: 8871 Type: RemoteJudge 3000ms 512MiB Tried: 0 Accepted: 0 Difficulty: 3 Uploaded By: Tags>constructive algorithms*1000

Two Out of Three

No submission language available for this problem.

Description

You are given an array a1,a2,,ana_1, a_2, \ldots, a_n. You need to find an array b1,b2,,bnb_1, b_2, \ldots, b_n consisting of numbers 11, 22, 33 such that exactly two out of the following three conditions are satisfied:

  1. There exist indices 1i,jn1 \leq i, j \leq n such that ai=aja_i = a_j, bi=1b_i = 1, bj=2b_j = 2.
  2. There exist indices 1i,jn1 \leq i, j \leq n such that ai=aja_i = a_j, bi=1b_i = 1, bj=3b_j = 3.
  3. There exist indices 1i,jn1 \leq i, j \leq n such that ai=aja_i = a_j, bi=2b_i = 2, bj=3b_j = 3.

If such an array does not exist, you should report it.

Each test contains multiple test cases. The first line contains a single integer tt (1t500)(1 \leq t \leq 500) — the number of test cases. Each test case is described as follows.

The first line of each test case contains an integer nn (1n100)(1 \leq n \leq 100) — the length of the array aa.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai100)(1 \leq a_i \leq 100) — the elements of the array aa.

For each test case, print -1 if there is no solution. Otherwise, print b1,b2,,bnb_1, b_2, \ldots, b_n — an array consisting of numbers 11, 22, 33 that satisfies exactly two out of three conditions. If there are multiple possible answers, you can print any of them.

Input

Each test contains multiple test cases. The first line contains a single integer tt (1t500)(1 \leq t \leq 500) — the number of test cases. Each test case is described as follows.

The first line of each test case contains an integer nn (1n100)(1 \leq n \leq 100) — the length of the array aa.

The second line of each test case contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (1ai100)(1 \leq a_i \leq 100) — the elements of the array aa.

Output

For each test case, print -1 if there is no solution. Otherwise, print b1,b2,,bnb_1, b_2, \ldots, b_n — an array consisting of numbers 11, 22, 33 that satisfies exactly two out of three conditions. If there are multiple possible answers, you can print any of them.

Sample Input 1

9
6
1 2 3 2 2 3
7
7 7 7 7 7 7 7
4
1 1 2 2
7
1 2 3 4 5 6 7
5
2 3 3 3 2
3
1 2 1
9
1 1 1 7 7 7 9 9 9
1
1
18
93 84 50 21 88 52 16 50 63 1 30 85 29 67 63 58 37 69

Sample Output 1

1 2 3 1 1 1 
-1
3 2 2 1 
-1
2 1 2 1 3 
-1
1 1 2 2 1 2 2 3 3
-1
3 2 1 3 3 3 3 2 2 1 1 2 3 1 3 1 1 2

Note

In the first test case, b=[1,2,3,1,1,1]b = [1, 2, 3, 1, 1, 1] satisfies condition 11 because for i=4i = 4, j=2j = 2: ai=aja_i = a_j, bi=1b_i = 1, and bj=2b_j = 2. It also satisfies condition 22 because for i=6i = 6, j=3j = 3: ai=aja_i = a_j, bi=1b_i = 1, and bj=3b_j = 3. However, it does not satisfy condition 33. In total, exactly two out of three conditions are satisfied.