Josh is a townplanner, and is in charge of the roads in his local village. The village contains houses numbered from to .
A road configuration is a set of roads with each road connecting two different houses bidirectionally, such that every house is reachable from every other house using the roads. There is at most one road between any two houses.
Currently, there is a road configuration , with the -th road connecting houses and . However, he wants to redesign the village so that ends up with a road configuration , with the -th road connecting houses and .
Due to a limited supply of gravel, he can only make operations in which he moves one road, by repeatedly deleting a road and adding another road. However, so that people can still travel around, all houses must be reachable from all other houses at all times. Specifically:
- He chooses a road from the current road configuration, and deletes it. After deletion, every house must still be reachable from every other house using the roads.
- Then, he adds a road between any two different houses that do not already have a road between them.
Can you help him achieve his goal? For full points, you must use as few operations as possible.
Note: it does not matter which road in corresponds to which road in .
Constraints
No two houses have multiple roads between them in , or multiple roads betweem them in .
Every house is reachable from every other house using only the roads in , and only the roads in .
Scoring
It can be proven that there always exists a sequence of operations transforming the road configuration from to with at most operations.
To score any points, your solution must use at most operations. If you output a valid solution with the fewest possible number of operations, you will receive of the points. Otherwise, if you output a valid solution with at most operations, you will receive of the points.
Input Specification
The first line contains a single integer, .
The -th of the following lines contains two space-separated integers, and .
The -th of the following lines contains two space-separated integers, and .
Output Specification
On the first line, output an integer , indicating the number of operations you will make.
On each of the next lines, output a line in the form w x y z
, indicating that you will remove a road between houses and , and add a road between houses and .
Sample Input
4
1 2
2 3
3 4
1 4
2 1
2 3
2 4
1 3
Sample Output
2
3 4 4 2
1 4 3 1
Comments