You are given a directed graph with $n$ vertices and $m$ edges. Your task is to find the length of the longest sequence $a$ of distinct integers from $1$ to $n$ such that the following condition holds:
- Let $l$ be the length of $a$. Then for all integers $i \in [2, l]$ and all vertices $v$ such that there exists an edge $(v, a_i)$, there exists an index $j < i$ such that $a_j = v$.
Input
First line contains $2$ integers $n, m$ ($2 \le n \le 3 \cdot 10^5, 0 \le m \le 3 \cdot 10^5$) — number of vertices and edges of the graph.
Next $m$ lines contain pairs of integers $u_i, v_i$ ($1 \le u_i, v_i \le n$) — edges of the graph. The graph is allowed to have loops and multiple edges.
Output
In the first line, output the maximal length of the correct sequence $l$.
Examples
Sample Input 1
5 0
Sample Output 1
5
Sample Input 2
5 5 1 2 3 2 2 4 3 5 5 3
Sample Output 2
5
Sample Input 3
3 3 1 1 2 2 3 3
Sample Output 3
1
Note
In the first sample case, one of the correct sequences could be $\{1, 2, 3, 4, 5\}$.
In the second sample case, one of the correct sequences could be $\{3, 5, 1, 2, 4\}$.
In the third sample case, one of the correct sequences could be $\{1\}$. Sequences $\{2\}$ and $\{3\}$ also satisfy the conditions of the problem.