#P1354E. Graph Coloring
Graph Coloring
No submission language available for this problem.
Description
You are given an undirected graph without self-loops or multiple edges which consists of vertices and edges. Also you are given three integers , and .
Can you label each vertex with one of three numbers 1, 2 or 3 in such way, that:
- Each vertex should be labeled by exactly one number 1, 2 or 3;
- The total number of vertices with label 1 should be equal to ;
- The total number of vertices with label 2 should be equal to ;
- The total number of vertices with label 3 should be equal to ;
- for each edge , where is the label of vertex .
If there are multiple valid labelings, print any of them.
The first line contains two integers and (; ) — the number of vertices and edges in the graph.
The second line contains three integers , and () — the number of labels 1, 2 and 3, respectively. It's guaranteed that .
Next lines contan description of edges: the -th line contains two integers , (; ) — the vertices the -th edge connects. It's guaranteed that the graph doesn't contain self-loops or multiple edges.
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length consisting of 1, 2 and 3. The -th letter should be equal to the label of the -th vertex.
If there is no valid labeling, print "NO" (without quotes).
Input
The first line contains two integers and (; ) — the number of vertices and edges in the graph.
The second line contains three integers , and () — the number of labels 1, 2 and 3, respectively. It's guaranteed that .
Next lines contan description of edges: the -th line contains two integers , (; ) — the vertices the -th edge connects. It's guaranteed that the graph doesn't contain self-loops or multiple edges.
Output
If valid labeling exists then print "YES" (without quotes) in the first line. In the second line print string of length consisting of 1, 2 and 3. The -th letter should be equal to the label of the -th vertex.
If there is no valid labeling, print "NO" (without quotes).