Among the N planets somewhere in Galaxy, there’s no way to move from one to another initially. To make it convenient to travel between any two planets, you can arbitrarily build some one-way wormholes between any two of them.
Pay attention that inverse wormholes will make the space unstable, which means you cannot build wormhole from u to v and wormhole from v to u at the same time.
If for any two planets u,v there always exists at least one path from u to v consists of no more than d wormholes, we can call the wormhole system with inconvenience d.
Obviously you can construct wormhole systems with different inconvenience values by building different sets of wormholes. Please give a solution to make d as small as possible.
Attention: Loops and multiple wormholes in your solution will also be treated as WRONG ANSWER.
输入描述:
One integer N
, the number of planets.
输出描述:
Two numbers in the first line, d and m,indicate the minimum inconvenience and the number of wormholes in your solution.
Then m lines indicate your solution, oneline describing one wormhole from u to v
.