Build Roads


Submit solution

Points: 100
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Add the minimum number of two-way roads so every pair of cities becomes connected.

Input

The first line contains n and m. The next m lines contain existing roads.

  • 1 <= n <= 1000

Output

Print k, then k roads. Use the smallest-numbered vertex of each component and connect consecutive representatives in increasing order.

Example

Input
6 3
1 2
2 3
5 6
Output
2
1 4
4 5

Comments

There are no comments at the moment.