Mirko works at a data centre. Today he has to copy a file of 1 GiB to n computers. The computers are numbered 1 through n, and n−1 network cables each connect two computers directly. Between any two computers there is exactly one path, so the network is a tree.
Mirko placed the file by hand on computer a and computer b. He now writes the commands that move the file to every other computer. The file can be copied from computer x to computer y only when the two computers are connected by a cable, and one copy takes exactly one minute. At any moment a computer takes part in at most one copy, while any number of different pairs may copy at the same time. So once the copy from x to y finishes, during the next minute the file can be copied from x to w and from y to z at the same time.
Find the smallest number of minutes after which every computer holds the file.

In the first example every computer holds the file after two minutes.