#AGC009D. Uninity

Uninity

Score : 14001400 points

Problem Statement

We will recursively define uninity of a tree, as follows: (Uni is a Japanese word for sea urchins.)

  • A tree consisting of one vertex is a tree of uninity 00.
  • Suppose there are zero or more trees of uninity kk, and a vertex vv. If a vertex is selected from each tree of uninity kk and connected to vv with an edge, the resulting tree is a tree of uninity k+1k+1.

It can be shown that a tree of uninity kk is also a tree of uninity k+1,k+2,...k+1,k+2,..., and so forth.

You are given a tree consisting of NN vertices. The vertices of the tree are numbered 11 through NN, and the ii-th of the N1N-1 edges connects vertices aia_i and bib_i.

Find the minimum kk such that the given tree is a tree of uninity kk.

Constraints

  • 2N1052 \leq N \leq 10^5
  • 1ai,biN(1iN1)1 \leq a_i, b_i \leq N(1 \leq i \leq N-1)
  • The given graph is a tree.

Input

The input is given from Standard Input in the following format:

NN

a1a_1 b1b_1

:

aN1a_{N-1} bN1b_{N-1}

Output

Print the minimum kk such that the given tree is a tree of uninity kk.

7
1 2
2 3
2 4
4 6
6 7
7 5
2

A tree of uninity 11 consisting of vertices 11, 22, 33 and 44 can be constructed from the following: a tree of uninity 00 consisting of vertex 11, a tree of uninity 00 consisting of vertex 33, a tree of uninity 00 consisting of vertex 44, and vertex 22.

A tree of uninity 11 consisting of vertices 55 and 77 can be constructed from the following: a tree of uninity 11 consisting of vertex 55, and vertex 77.

A tree of uninity 22 consisting of vertices 11, 22, 33, 44, 55, 66 and 77 can be constructed from the following: a tree of uninity 11 consisting of vertex 11, 22, 33 and 44, a tree of uninity 11 consisting of vertex 55 and 77, and vertex 66.

12
1 2
2 3
2 4
4 5
5 6
6 7
7 8
5 9
9 10
10 11
11 12
3