Tree Diameter#11428

Tree Diameter

1 second
128 megabytes
Easy

A tree consisting of vertices is given.

The diameter of a tree is the maximum distance between two vertices. Find the diameter of the given tree.

Input

The first line contains an integer n~(1 \le n \le 2 \cdot 10^5) — the number of vertices in the tree. The vertices are numbered from to .

Each of the following n - 1 lines describes an edge and contains two integers and b~(1 \le a, b \le n), indicating that there is an edge between vertices and .

Output

Print one integer — the diameter of the tree.

Examples

Example 1

Loading
Loading