Given a tree on $N$ nodes and two nodes $U$, $V$, print the number of edges on the unique path between them.
Input
First line $N$ ($2 \le N \le 1000$); then $N-1$ edge lines $u$, $v$; last line $U$, $V$ ($U \ne V$).
Output
Print the distance (edge count) between $U$ and $V$.
Example 1
Input
5 1 2 1 3 3 4 3 5 2 5
Output
3
Example 2
Input
4 1 2 2 3 3 4 1 4
Output
3
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.