SP1478 PT07B - The Easiest Problem

Description

You are given an unweighted, undirected tree _T_. We say _T_ is special iff it has this property: "All nodes of degree greater than or equal to 3 are surrounded by at most two nodes of degree two or greater." Finding maximal size subtree of this tree so that it's a special tree.

Input Format

The first line of the input file contains one integer _N_ --- number of nodes in the tree (0 < _N_

Output Format

At the first line, output number of nodes in the optimal subtree you found. Next lines, print all edges belong to that subtree, each line contains a pair _u_ _v_ means an edge between node _u_ and node _v_.