Cover the Tree
题号:NC207135
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Given an unrooted tree, you should choose the minimum number of chains that all edges in the tree are covered by at least one chain. Print the minimum number and one solution. If there are multiple solutions, print any of them.

输入描述:

The first line contains one integer , denoting the size of the tree.
Following lines each contains two integers , denoting an edge in the tree.
It's guaranteed that the given graph forms a tree.

输出描述:

The first line contains one integer , denoting the minimum number of chains to cover all edges.
Following lines each contains two integers , denoting a chain you have chosen. Here is permitted, which covers no edge.
示例1

输入

复制
5
1 2
1 3
2 4
2 5

输出

复制
2
2 3
4 5

说明