Ural State University Problem Set Archive with Online Judge System

English
Russian
Online Judge
About
Submit Problem
Problem Set
Status (online)
Webboard
FAQ
Links
Authors
Register
Update your info
Authors ranklist
Online Contests
Current Contest
      Problems
      Submit
      Status
      Monitor
Scheduled Contests
Archive
Summary Ranklist


Roadworks
Time Limit: 1.0 second
Memory Limit: 4 000 KB

Once upon a time there was a king. One day the king counted up the collected taxes and decided to spend the money for the road maintenance. There were N cities in that kingdom and M two-way roads connected them in such way that one could travel from a city to others using these roads. The road network was catastrophic without repairing, so the king made up his mind to repair as many roads as possible during the summer, before the money depreciated. The inhabitants of the kingdom were shocked to know that all the ways they used to go would be blocked for summer. So the king promised that at most one road from a city would be blocked. Help the king to fulfil his plan without displeasing the citizens.

Input

The first line of input contains two natural numbers N and M (2 ≤ N ≤ 105, M = N - 1), separated with a space. Each of the next M lines describes a road in the form (ai, bi), where ai and bi are numbers of the cities connected with i'th road (1 ≤ ai, biN).

Output

The first line of output should contain the only natural number K being the maximum number of roads that the king can close for maintenance without raising disorders in his kingdom. The next K lines should describe these roads in the same form as they were given in the input.

Sample Input

4 3
1 2
2 3
3 4

Sample Output

2
1 2
3 4

Problem Author: Dmitry Ivankov & Alexander Ipatov
Problem Source: Petrozavodsk summer training camp, August 2005.


Print     Statistic     Discuss     Submit

The Team © 2000-2005. All rights reserved.