The Great Revegetation (Bronze)
A lengthy drought has left Farmer John's pastures devoid of grass. However, with the rainy season arriving soon, the time has come to "revegetate".
In Farmer John's shed, he has four buckets, each with a different type of grass seed. He wishes to sow each pasture with one of these types of seeds. Being a dairy farmer, Farmer John wants to make sure each of his cows has a varied diet. Each of his cows has two favourite pastures, and he wants to be sure different types of grass are planted in each, so every cow can choose between two types of grass. Farmer John knows that no pasture is a favourite of more than 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 numbers and . Each of the next lines contains two integers in the range , describing the pair of pastures that are the two favourites for one of Farmer John's cows.
Output
Output an -digit number, with each digit in the range , describing the grass type to be planted in each field. The first digit corresponds to the grass type for field , the second digit to field , and so on. If there are multiple valid solutions, print only the -digit number that is smallest among all of them.