CF804C Ice cream coloring
Description
Isart and Modsart were trying to solve an interesting problem when suddenly Kasra arrived. Breathless, he asked: "Can you solve a problem I'm stuck at all day?"
We have a tree $ T $ with $ n $ vertices and $ m $ types of ice cream numerated from $ 1 $ to $ m $ . Each vertex $ i $ has a set of $ s_{i} $ types of ice cream. Vertices which have the $ i $ -th ( $ 1
Input Format
The first line contains two integer $ n $ and $ m $ ( $ 1
Output Format
Print single integer $ c $ in the first line — the minimum number of colors to paint the vertices in graph $ G $ .
In the second line print $ m $ integers, the $ i $ -th of which should be the color of the $ i $ -th vertex. The colors should be between $ 1 $ and $ c $ . If there are some answers, print any of them.
Explanation/Hint
In the first example the first type of ice cream is present in the first vertex only, so we can color it in any color. The second and the third ice cream are both presented in the second vertex, so we should paint them in different colors.
In the second example the colors of the second, the fourth and the fifth ice cream should obviously be distinct.