The Great Revegetation (Bronze)

Interview

Time limit2sMemory limit512 MB

Summary
Assign each of N pastures one of 4 grass types so that every listed pair differs, choosing the lexicographically smallest N-digit answer.
Level

Medium5 of 10

Topics
Graph, Greedy, Backtracking, Implementation
Solved
No attempts yet

Problem

A lengthy drought has left Farmer John's NN pastures with no grass at all. With the rainy season arriving soon, the time has come to "revegetate."

In Farmer John's shed there are four buckets, each holding a different type of grass seed. He wants to sow each pasture with one of these types of seeds. As a dairy farmer, Farmer John wants his cows to have a varied diet. Each of his MM cows has two favorite pastures, and different types of grass must be planted in those two pastures so that every cow can choose between two types of grass. Farmer John knows that no pasture is a favorite of more than 33 cows.

Help Farmer John choose a grass type for each pasture so that the nutritional needs of all cows are satisfied.

Input

The first line contains NN (2≤N≤1002 \leq N \leq 100) and MM (1≤M≤1501 \leq M \leq 150). Each of the next MM lines contains two integers in the range 1…N1 \ldots N, the two pastures that are the favorites of one of Farmer John's cows.

Output

Output an NN-digit number describing the grass type to be planted in each pasture, with each digit in the range 1…41 \ldots 4. The first digit is the grass type for pasture 11, the second digit is the grass type for pasture 22, and so on. If there are multiple valid solutions, print only the smallest NN-digit number among them.

Examples1

  1. Example 1

    Input
    5 6
    4 1
    4 2
    4 3
    2 5
    1 2
    1 5
    
    Expected output
    12133