The following is the **minimum diameter problem**.
- You are given a forest (an acyclic undirected graph) with $n$ vertices. Consider adding some edges to the forest to turn it into a tree. Find the minimum possible diameter of the resulting tree.
Here the diameter of a tree is defined as the maximum distance among all pairs of vertices. The distance of two vertices in a tree is defined as the number of edges on the shortest path between them.
You are given a forest of $n$ vertices and $m$ edges. The edges are numbered from $1,2,...,m$. For each $i=1,2,...,m$, consider the forest only containing the first $i$ edges, and compute the answer to the **minimum diameter problem** on this forest.