codeforces#P1328D. Carousel
Carousel
Description
The round carousel consists of figures of animals. Figures are numbered from to in order of the carousel moving. Thus, after the -th figure the figure with the number 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 -th figure equals .

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 distinct colors, then the colors of figures should be denoted with integers from to .
The input contains one or more test cases.
The first line contains one integer () — the number of test cases in the test. Then test cases follow. One test case is given on two lines.
The first line of the test case contains one integer () — the number of figures in the carousel. Figures are numbered from to in order of carousel moving. Assume that after the -th figure the figure goes.
The second line of the test case contains integers (), where is the type of the animal of the -th figure.
The sum of over all test cases does not exceed .
Print answers, for each test case print two lines.
In the first line print one integer — the minimum possible number of distinct colors of figures.
In the second line print integers (), where is the color of the -th figure. If there are several answers, you can print any.
Input
The input contains one or more test cases.
The first line contains one integer () — the number of test cases in the test. Then test cases follow. One test case is given on two lines.
The first line of the test case contains one integer () — the number of figures in the carousel. Figures are numbered from to in order of carousel moving. Assume that after the -th figure the figure goes.
The second line of the test case contains integers (), where is the type of the animal of the -th figure.
The sum of over all test cases does not exceed .
Output
Print answers, for each test case print two lines.
In the first line print one integer — the minimum possible number of distinct colors of figures.
In the second line print integers (), where is the color of the -th figure. If there are several answers, you can print any.