Nils is participating in the Canadian Cactus Competition (CCC)! Whilst the other competitors have brought their prized tall cacti, all dressed up with costumes and googly eyes, Nils has brought in something truly beautiful - a cactus graph!
The graph contains
Each of the nodes has a value, which is an integer between
The values of the nodes have not yet been finalised, so to boost his chances of winning first place, Nils wants to find the maximum possible beauty of the graph, and any possible allocation of values to nodes which achieves this beauty.
Constraints
There is at most one edge between any pair of nodes.
The graph is connected.
Subtask 1 [20%]
Subtask 2 [40%]
Subtask 3 [40%]
No additional constraints.
Input Specification
The first line of input contains three space-separated integers,
The
Output Specification
The first line of output should contain the maximum possible beauty of the graph.
The second line of output should contain
If there are multiple valid answers, output any of them.
Sample Input
4 4 2
1 2
2 3
1 3
3 4
Sample Output
1
0 1 2 0
Explanation
The first edge has a colour of
The second edge has a colour of
The third edge has a colour of
The fourth edge has a colour of
Here,
Then, the beauty of the graph is
Comments