# Tree Diameter
## Problem Statement
You are given a tree consisting of $n$ nodes. The nodes are numbered from $1$ to $n$. The diameter of a tree is defined as the maximum distance (number of edges) between any two nodes in the tree. Your task is to determine and print the diameter of the given tree.

## Input Format
The first line contains a single integer $n$ ($1 \le n \le 2 \times 10^5$), representing the number of nodes in the tree. The nodes are numbered from $1$ to $n$.
Each of the next $n-1$ lines contains two integers $u$ and $v$ ($1 \le u, v \le n$, $u \ne v$), indicating that there is an edge between node $u$ and node $v$.
## Output Format
Print a single integer, the diameter of the tree.
## Sample Test Cases
### Sample Input 1
```
5
1 2
1 3
3 4
3 5
```
### Sample Output 1
```
3
```
## Constraints
- $1 \le n \le 2 \times 10^5$
- $1 \le u, v \le n$
- The given graph is guaranteed to be a tree.
- Time limit: 1 second
- Memory limit: 256 MB
## Explanation
For Sample Input 1, the tree has 5 nodes and 4 edges. The longest path in this tree has a length of 3 edges. One such path is between node 2 and node 5, specifically $2 \to 1 \to 3 \to 5$. Another path of length 3 is $4 \to 3 \to 1 \to 2$. Thus, the diameter of the tree is 3.