- Time limit: 1.00 s
- Memory limit: 512 MB
Byteland has cities, and roads between them. The goal is to construct new roads so that there is a route between any two cities.
Your task is to find out the minimum number of roads required, and also determine which roads should be built.
Input
The first input line has two integers and : the number of cities and roads. The cities are numbered .
After that, there are lines describing the roads. Each line has two integers and : there is a road between those cities.
A road always connects two different cities, and there is at most one road between any two cities.
Output
First print an integer : the number of required roads.
Then, print lines that describe the new roads. You can print any valid solution.
Constraints
Example
Input:
4 2 1 2 3 4
Output:
1 2 3