#P1070L. Odd Federalization

    ID: 4970 Type: RemoteJudge 5000ms 256MiB Tried: 0 Accepted: 0 Difficulty: 10 Uploaded By: Tags>constructive algorithms*2600

Odd Federalization

Description

Berland has nn cities, some of which are connected by roads. Each road is bidirectional, connects two distinct cities and for each two cities there's at most one road connecting them.

The president of Berland decided to split country into rr states in such a way that each city will belong to exactly one of these rr states.

After this split each road will connect either cities of the same state or cities of the different states. Let's call roads that connect two cities of the same state "inner" roads.

The president doesn't like odd people, odd cities and odd numbers, so he wants this split to be done in such a way that each city would have even number of "inner" roads connected to it.

Please help president to find smallest possible rr for which such a split exists.

The input contains one or several test cases. The first input line contains a single integer number tt — number of test cases. Then, tt test cases follow. Solve test cases separately, test cases are completely independent and do not affect each other.

Then tt blocks of input data follow. Each block starts from empty line which separates it from the remaining input data. The second line of each block contains two space-separated integers nn, mm (1n20001 \le n \le 2000, 0m100000 \le m \le 10000) — the number of cities and number of roads in the Berland. Each of the next mm lines contains two space-separated integers — xix_i, yiy_i (1xi,yin1 \le x_i, y_i \le n; xiyix_i \ne y_i), which denotes that the ii-th road connects cities xix_i and yiy_i. Each pair of cities are connected by at most one road.

Sum of values nn across all test cases doesn't exceed 20002000. Sum of values mm across all test cases doesn't exceed 1000010000.

For each test case first print a line containing a single integer rr — smallest possible number of states for which required split is possible. In the next line print nn space-separated integers in range from 11 to rr, inclusive, where the jj-th number denotes number of state for the jj-th city. If there are multiple solutions, print any.

Input

The input contains one or several test cases. The first input line contains a single integer number tt — number of test cases. Then, tt test cases follow. Solve test cases separately, test cases are completely independent and do not affect each other.

Then tt blocks of input data follow. Each block starts from empty line which separates it from the remaining input data. The second line of each block contains two space-separated integers nn, mm (1n20001 \le n \le 2000, 0m100000 \le m \le 10000) — the number of cities and number of roads in the Berland. Each of the next mm lines contains two space-separated integers — xix_i, yiy_i (1xi,yin1 \le x_i, y_i \le n; xiyix_i \ne y_i), which denotes that the ii-th road connects cities xix_i and yiy_i. Each pair of cities are connected by at most one road.

Sum of values nn across all test cases doesn't exceed 20002000. Sum of values mm across all test cases doesn't exceed 1000010000.

Output

For each test case first print a line containing a single integer rr — smallest possible number of states for which required split is possible. In the next line print nn space-separated integers in range from 11 to rr, inclusive, where the jj-th number denotes number of state for the jj-th city. If there are multiple solutions, print any.

Sample Input 1

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

Sample Output 1

1
1 1 1 1 1 
2
2 1 1 1 1 1