Connected Components


You are given an undirected graph with nn vertices numbered from 11 to nn.

Find all connected components of the graph. Components are numbered in the order they are first discovered by scanning vertices from 11 to nn. When an unvisited vertex is found, it starts the next component, and every vertex reachable from it receives that component number.

Input

The first line contains two integers nn and mm, the number of vertices and edges.

The next mm lines each contain two integers aa and bb, meaning there is an undirected edge between vertices aa and bb.

Output

Print one integer kk, the number of connected components.

Then print nn integers: the component label of each vertex from 11 to nn.

Constraints

  • 1≤n≤2000001 \le n \le 200000
  • 0≤m≤3000000 \le m \le 300000
  • 1≤a,b≤n1 \le a, b \le n

Example 1

Input 1
5 3
1 2
2 3
4 5
Output 1
2
1 1 1 2 2
Explanation

Vertices 1,2,31, 2, 3 form the first component, and vertices 4,54, 5 form the second component.

Example 2

Input 2
6 2
2 4
3 6
Output 2
4
1 2 3 2 4 3
Explanation

Vertex 11 starts component 11. Vertices 22 and 44 form component 22. Vertices 33 and 66 form component 33. Vertex 55 starts component 44.

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.