- Time limit: 1.00 s
- Memory limit: 512 MB
However, if any connection breaks down, it will no longer be possible to send data between some computers. Your task is to add the minimum number of new connections in such a way that you can still send data between any two computers even if any single connection breaks down.
The first input line has an integer $n$: the number of computers. The computers are numbered $1,2,\dots,n$.
After this, there are $n-1$ lines describing the connections. Each line has two integers $a$ and $b$: there is a connection between computers $a$ and $b$.
First print an integer $k$: the minimum number of new connections. After this, print $k$ lines describing the connections. You can print any valid solution.
- $3 \le n \le 10^5$
- $1 \le a,b \le n$