CF600F Edge coloring of bipartite graph

Description

You are given an undirected bipartite graph without multiple edges. You should paint the edges of graph to minimal number of colours, so that no two adjacent edges have the same colour.

Input Format

The first line contains three integers $ a,b,m $ ( $ 1

Output Format

In the first line print integer $ c $ — the minimal number of colours. The second line should contain $ m $ integers from $ 1 $ to $ c $ — the colours of the edges (in the order they appear in the input). If there are several solutions, you can print any one of them.