CF980F Cactus to Tree
Description
You are given a special connected undirected graph where each vertex belongs to at most one simple cycle.
Your task is to remove as many edges as needed to convert this graph into a tree (connected graph with no cycles).
For each node, independently, output the maximum distance between it and a leaf in the resulting tree, assuming you were to remove the edges in a way that minimizes this distance.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first sample, a possible way to minimize the maximum distance from vertex $ 1 $ is by removing the marked edges in the following image:
Note that to minimize the answer for different nodes, you can remove different edges.