Problem C. bomb
题号:NC229642
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Xiaoxiang has a directed graph with  points and  edges. At first, every point on this directed graph was white.

Recently, Xiaoxiang wants to color every point on this directed graph black. He can carry out several rounds of dyeing, and the dyeing rules of each round are as follows:

  • Dyeing In each dyeing round, Xiaoxiang can dye any number of points.

  • In each dyeing round, a pair of different ,  cannot appear, Let point  can reach point .
Now, Xiaoxiang would like to ask you to calculate that every point on this directed graph can be dyed only after at least several rounds of dyeing.

输入描述:

Two positive integers  in the first row represent the number of points and edges of this directed graph. Where the number of the point is .

Next  lines, each line has two positive integers , indicating that there is a directed edge connecting from  to .


输出描述:

It contains only one line and a positive integer, which indicates the minimum number of rounds needed to dye this directed graph.
示例1

输入

复制
5 4
1 2
2 3
3 1
4 5

输出

复制
3