The Kingdom of Belzerg consists of
To increase the connectedness of the citizens and strengthen their defense against the Demon King's advancements, the King of Belzerg has ordered for
Pave a road of the shortest possible length between city
and city on opposite sides of the forest.
However, he did not mention which of the cities should be on which side of the forest! You took this to mean that both interpretations would be acceptable, and so you will pave the
Of course, you know the ultimate goal is to increase the connectedness of the citizens. We say that two cities are connected if it is possible for a citizen from the first city to reach the second city by walking along the paved roads, possibly passing through some other cities in the process. Here, note that if any two roads intersect at any point, it is possible for the citizen to switch from one road to the other.
As such, you wonder: out of all possible interpretations of the king's commands, what is the smallest possible size of the largest set of cities in which no two cities are connected? Naturally, you should also produce a list of roads to pave where this size is achieved.
Constraints
Each city number appears at most twice in the list.
Subtask 1 [10%]
Subtask 2 [30%]
Subtask 3 [30%]
Each city number appears at most once in the list.
Subtask 4 [30%]
No additional constraints.
Input Specification
The first line contains
The next
Output Specification
Output a single integer on the first line, the smallest possible size of the largest set of cities in which no two cities are connected.
Then, output a space-separated sequence of
Sample Input
7 6
4 2
3 2
1 1
4 5
6 7
6 7
Sample Output
6
0 1 0 0 1 0
Explanation
A diagram of the paved roads is given below:
For example, city
Comments