#K45102. Minimum Crop Types for Adjacent Plots

    ID: 27679 Type: Default 1000ms 256MiB

Minimum Crop Types for Adjacent Plots

Minimum Crop Types for Adjacent Plots

A farmer owns N plots of land and wishes to plant crops such that no two adjacent plots share the same crop type. The plots are connected by adjacency constraints, and the problem is to determine the minimum number of different crop types required to meet these constraints.

Mathematically, if we consider the plots as vertices of a tree (an acyclic connected graph), then for N > 1, the chromatic number is given by $$\chi(G)=2$$. In the trivial case where N = 1, only one crop is needed.

Your task is to implement a solution that reads input from stdin and prints the answer to stdout.

inputFormat

The first line contains an integer N, representing the number of plots.

The second line contains an integer M, the number of edges (adjacency relationships).

The next M lines each contain two space-separated integers u and v, indicating that plot u is adjacent to plot v.

outputFormat

Output a single integer representing the minimum number of different crop types required.

## sample
5
4
1 2
2 3
3 4
4 5
2

</p>