There are two machines in a factory. Both machines can do one job in a day, and they can work simultaneously.
There are a total of $n$ jobs to be done. For some jobs $a$ and $b$ it is known that $a$ must be done before $b$.
What is the minimum number of days needed to do all the jobs?
Input
The first input line contains two integers $n$ and $m$: the number of jobs and the number of relations. The jobs are numbered $1,2,\ldots,n$.
After this, there are $m$ lines that describe the relations. Each line contains two integers $a$ and $b$: job $a$ must be done before job $b$.
Output
Print one integer: the minimum number of days needed to do all the jobs.
You can assume that there is a way to do all the jobs.
Constraints
- $1 \le n \le 500$
- $0 \le m \le \frac{n(n-1)}{2}$
Example
Input:
3 2
1 2
1 3
Output:
2