Problem: The round carousel consists of n figures of animals. Figures are numbered from 1 to n in order of the carousel moving. Thus, after the n-th figure the figure with the number 1 follows. Each figure has its own type — the type of the animal corresponding to this figure (the horse, the tiger and so on). The type of animal of the i-th figure equals t_i.

<image> The example of the carousel for n=9 and t=[5, 5, 1, 15, 1, 5, 5, 1, 1]. 

You want to color each figure in one of the colors. You think that it's boring if the carousel contains two different figures (with the distinct types of animals) going one right after another and colored in the same color.

Your task is to color the figures in such a way that the number of distinct colors used is the minimum possible and there are no figures of the different types going one right after another and colored in the same color. If you use exactly k distinct colors, then the colors of figures should be denoted with integers from 1 to k.

Input

The input contains one or more test cases.

The first line contains one integer q (1 ≤ q ≤ 10^4) — the number of test cases in the test. Then q test cases follow. One test case is given on two lines.

The first line of the test case contains one integer n (3 ≤ n ≤ 2 ⋅ 10^5) — the number of figures in the carousel. Figures are numbered from 1 to n in order of carousel moving. Assume that after the n-th figure the figure 1 goes.

The second line of the test case contains n integers t_1, t_2, ..., t_n (1 ≤ t_i ≤ 2 ⋅ 10^5), where t_i is the type of the animal of the i-th figure.

The sum of n over all test cases does not exceed 2⋅10^5.

Output

Print q answers, for each test case print two lines.

In the first line print one integer k — the minimum possible number of distinct colors of figures.

In the second line print n integers c_1, c_2, ..., c_n (1 ≤ c_i ≤ k), where c_i is the color of the i-th figure. If there are several answers, you can print any.

Example

Input


4
5
1 2 1 2 2
6
1 2 2 1 2 2
5
1 2 1 2 3
3
10 10 10


Output


2
1 2 1 2 2
2
2 1 2 1 2 1
3
2 3 2 3 1
1
1 1 1 

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.math.*;

 
 public class Main	{
	static class node{
		int a, b;
		public node(int x, int y) {
			a = x;
			b = y;
		}
	}
   static class Pair implements Comparable<Pair>{

	   int a;
	   int b;
//	   int ind;
//	   public Pair(int x, long y) {a = x;b=y;}
	   public Pair(int x, int y) {a = x;b=y;}
//	   public Pair(int x,int y, int z){a=x;b=y;ind = z;}
	   public int compareTo(Pair p){
		   if(a == p.a)
			   return b - p.b;
		   else
			   return a - p.a;
	   }
//		@Override
//		public int hashCode() {
//			final int prime = 31;
//			int result = 1;
//			result = prime * result + a;
//			result = prime * result + b;
//		   
//			return result;
//		}
//		@Override
//		public boolean equals(Object obj) {
//			Pair cur = (Pair)obj;
//			if((a==cur.a && b==cur.b))return true;
//			return false;
//		}
 } 

public static void main(String[] args) throws Exception {
   new Thread(null, null, "Anshum Gupta", 99999999) {
        public void run() {
            try {
                solve();
            } catch(Exception e) {
                e.printStackTrace();
                System.exit(1);
            }
        }
    }.start();
}
public static long gcd(long a,long b)
{
  if(a<b)
    return gcd(b,a);
  if(b==0)
    return a;
  return gcd(b,a%b);
  
}
static long lcm(int a,int b) {
  return  a*b / gcd(a,b);
}
    
static long pow(long x,long y){
    if(y == 0)return 1;
    if(y==1)return x;
    long a = pow(x,y/2);
    a = (a*a)%mod;
    if(y%2==0){
        return a;
    }
    return (a*x)%mod;
}

static long[]fact,inv_fact;
static long my_inv(long a) {
	return pow(a,mod-2);
}
static long bin(int a,int b) {
	if(a < b || a<0 || b<0)return 0;
    return ((fact[a]*inv_fact[a-b])%mod * inv_fact[b])%mod;
}
	
static void make_facts() {
  fact=new long[mxN];
  inv_fact = new long[mxN];
  fact[0]=inv_fact[0]=1L;
  for(int i=1;i<mxN;i++) {
	   fact[i] = (i*fact[i-1])%mod;
	   inv_fact[i] = my_inv(fact[i]);
  }
}
static void lazy(int st, int e, int tn) {
	if(lazy[tn] != INF) {
		tree[tn] = Math.min(tree[tn], lazy[tn]);
		if(st != e) {
			lazy[2*tn] = Math.min(lazy[2*tn], lazy[tn]);
			lazy[2*tn+1] = Math.min(lazy[2*tn+1], lazy[tn]);
		}
		lazy[tn] = INF;
	}
}
static void update(int ind, int val, int st, int e, int tn) {
	if(st == e) {
		tree[tn] = val;
		return;
	}
	int mid = (st + e) >> 1;	
  	if(ind <= mid)
		update(ind, val, st, mid, 2*tn);
  	else
		update(ind, val, mid+1, e, 2*tn+1);
	tree[tn] = Math.min(tree[2*tn], tree[2*tn+1]);
}
static int query(int l, int r, int st, int e, int tn) {
	if(st > r || e < l)return INF;
	
	if(st >= l && e <= r) {
		return tree[tn];
	}

	int mid = (st + e) >> 1;
	int x = query(l, r, st, mid, 2 * tn);
	int y = query(l, r, mid+1, e, 2 * tn + 1);
	return Math.min(x, y);
}
static final long mxx = (long)(3e18+5);
static final int mxN = (int)(1e5);
static final int mxV = (int)(1e5+5);
static long mod = (long)(1e9+7); //998244353;//
static int[]tree, lazy;
static final int INF = (int)1e9+5;
static boolean[]vis;
static ArrayList<ArrayList<Integer>> adj;
static int n, m, q, t, k, p;
static int[]a, c;
static char[]arr;
static boolean allequal() {
	int x = a[0];
	for(int i=1; i<n; i++) {
		if(a[i] != x)
			return false;
	}
	return true;
}
public static void solve() throws Exception {
   // solve the problem here
   MyScanner s = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out), true);
        int tc = s.nextInt();
        
        while(tc-->0){
        	n = s.nextInt();
        	a = new int[n];
        	c = new int[n];
        	for(int i=0; i<n; i++) {
        		a[i] = s.nextInt();
        	}
        	if(allequal()) {
        		out.println("1");
        		for(int i=0; i<n; i++) {
        			out.print("1 ");
        		}out.println();
        		continue;
        	}
        	if(n % 2 == 0) {
        		out.println("2");
        		int cur = 0;
        		for(int i=0; i<n; i++) {
        			out.print(cur+1 + " ");
        			cur ^= 1;
        		}out.println();
        		continue;
        	}
        	boolean pos = false;
        	int st = 0;
        	for(int i=0; i<n; i++) {
        		if(a[i] == a[(i+1) % n]) {
        			pos = true;
        			c[i] = c[(i+1)%n] = 0;
        			st = (i + 2) % n;
        			break;
        		}
        	}
        	if(pos) {
        		out.println(2);
        		int cur = 1;
        		for(int i=st; i<st+n-2; i++) {
        			c[i%n] = cur;
        			cur ^= 1;
        		}
        		for(int i=0; i<n; i++) {
        			out.print(c[i] + 1 + " ");
        		}out.println();
        		continue;
        	}
        	int xx = 0 ^ 1 ^ 2;
        	out.println(3);
        	c[n-1] = (a[0] == a[n-1] ? 0 : 1);
        	for(int i=1; i<n-1; i++) {
        		if(a[i] == a[i-1]) {
        			c[i] = c[i-1];
        		}
        		else c[i] = (c[i-1] + 1)%3;
        		if(i == n-2 && c[i] == c[i+1] && a[i] != a[i+1]) {
        			c[i] = xx ^ c[i-1] ^ c[i+1];
        		}
        	}
        	for(int i=0; i<n; i++) {
        		out.print(c[i] + 1 + " ");
        	}out.println();
        	
        }
        	
           
        out.flush();
}
 
	     
 
 
 
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
 
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt() { return Integer.parseInt(next()); }
        long nextLong() { return Long.parseLong(next()); }
        double nextDouble() { return Double.parseDouble(next()); }
         
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------
}