




import math as m


def   A		(__A  :       Tuple  ,							__A  :       Optional[Any]  ,							__A  :       Union[str, Any]=0.001			)  -> Optional[int]:







     """simple docstring"""


     return (f(a + h			) - f(a - h			)) / (2 * h)


def   A		(__A  :       Any  ,							__A  :       Union[str, Any]=0  ,							__A  :       List[Any]=100  ,							__A  :       List[Any]=0.0_001  ,							__A  :       List[Any]=1E-6  ,							__A  :       Union[str, Any]=False			)  -> List[Any]:







     """simple docstring"""


     UpperCAmelCase_		=				xa  # set the initial guess
     UpperCAmelCase_		=				[a]
     UpperCAmelCase_		=				abs(f(__A			)			)
     UpperCAmelCase_		=				lambda __A			: calc_derivative(__A  ,							__A  ,							h=__A			)  # noqa: E731  Derivative of f(x)
     for _ in range(__A			):
          if fa(__A			) == 0:
               raise ValueError('''No converging solution found'''			)
          UpperCAmelCase_		=				a - f(__A			) / fa(__A			)  # Calculate the next estimate
          if logsteps:
               steps.append(__A			)
          if error < maxerror:
               break
     else:
          raise ValueError('''Iteration limit reached, no converging solution found'''			)
     if logsteps:
          # If logstep is true, then log intermediate steps
          return a, error, steps
     return a, error


if __name__ == "__main__":
    from matplotlib import pyplot as plt

    snake_case_					:					Optional[Any]       						=			lambda x: m.tanh(x) ** 2 - m.exp(3 * x)  # noqa: E731
    snake_case_					:					str       						=			newton_raphson(
        f, xa=10, maxiter=1000, step=1e-6, logsteps=True
    )
    plt.plot([abs(f(x)) for x in steps])
    plt.xlabel("step")
    plt.ylabel("error")
    plt.show()
    print(f"solution = {{{solution:f}}}, error = {{{error:f}}}")








from __future__ import annotations






def     lowerCamelCase__				(   a ) ->  Union[str, Any]:
   global graph, reversed_graph, scc, component, visit, stack
   if visit[u]:
      return
   _A:    Optional[Any]						     =			True
   for v in graph[u]:
      dfs(a )
   stack.append(a )






def     lowerCamelCase__				(   a ) ->  List[Any]:
   global graph, reversed_graph, scc, component, visit, stack
   if visit[u]:
      return
   _A:    str						     =			True
   component.append(a )
   for v in reversed_graph[u]:
      dfsa(a )






def     lowerCamelCase__				(   ) ->  str:
   global graph, reversed_graph, scc, component, visit, stack
   for i in range(a ):
      dfs(a )
   _A:    Optional[Any]						     =			[False] * n
   for i in stack[::-1]:
      if visit[i]:
         continue
      _A:    Optional[Any]						     =			[]
      dfsa(a )
      scc.append(a )
   return scc


if __name__ == "__main__":
   # n - no of nodes, m - no of edges
   UpperCAmelCase__     ,UpperCAmelCase__						:	Any	     = list(map(int, input().strip().split()))

   UpperCAmelCase__						:	list[list[int]]	     = [[] for _ in range(n)]  # graph
   UpperCAmelCase__						:	list[list[int]]	     = [[] for i in range(n)]  # reversed graph
   # input graph data (edges)
   for _ in range(m):
      UpperCAmelCase__     ,UpperCAmelCase__						:	str	     = list(map(int, input().strip().split()))
      graph[u].append(v)
      reversed_graph[v].append(u)

   UpperCAmelCase__						:	list[int]	     = []
   UpperCAmelCase__						:	list[bool]	     = [False] * n
   UpperCAmelCase__						:	list[int]	     = []
   UpperCAmelCase__						:	list[int]	     = []
   print(kosaraju())



