406068: GYM102254 A Arnon-Degree of Separation

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Arnon-Degree of Separationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

The psychologist Arnon, in his researches in IME, developed the theory of the Arnon-Degree of Separation.

According to this theory, it's necessary at most $$$k$$$ friendship bonds to connect any two people in the world. But for his theory to impress people, especially his friends De Castro and Caio, he needs to discover $$$k$$$.

Since he is too busy going out with his girlfriend, he asks you to discover this value. He will give to you a sample test with $$$n$$$ people and $$$m$$$ friendship bonds and you have to answer the minimum integer $$$k$$$ such that the theory will be valid.

Input

The first line contains two integers, $$$n$$$ and $$$m$$$ ($$$2 \le n \le 2 \times 10^3, 0 \le m \le 2 \times 10^3$$$) — the number of people and the number of friendship bonds, respectively.

The next $$$m$$$ lines contains, each, two integers, $$$a$$$ and $$$b$$$ ($$$1 \le a, b \le n$$$, $$$a \neq b$$$) — indicating that $$$a$$$ and $$$b$$$ are friends.

Output

Print "=]" (without quotes) followed by an integer indicating the value of $$$k$$$.

In case it's not possible to reach some of the $$$n$$$ people, you should print "=[" (without quotes), instead.

ExamplesInput
5 4
1 2
2 3
3 4
4 5
Output
=] 4
Input
7 7
1 2
3 6
2 4
3 5
2 5
2 3
2 7
Output
=] 3

加入题单

上一题 下一题 算法标签: