






from __future__ import annotations







def 			lowercase__  (				A_:	Optional[int]		)  ->							Dict:







       """simple docstring"""






       global graph, reversed_graph, scc, component, visit, stack
       if visit[u]:
              return
       __UpperCAmelCase    							=True
       for v in graph[u]:
              dfs(A_		)
       stack.append(A_		)







def 			lowercase__  (				A_:	List[str]		)  ->							Union[str, Any]:







       """simple docstring"""






       global graph, reversed_graph, scc, component, visit, stack
       if visit[u]:
              return
       __UpperCAmelCase    							=True
       component.append(A_		)
       for v in reversed_graph[u]:
              dfsa(A_		)







def 			lowercase__  (				)  ->							str:







       """simple docstring"""






       global graph, reversed_graph, scc, component, visit, stack
       for i in range(A_		):
              dfs(A_		)
       __UpperCAmelCase    							=[False] * n
       for i in stack[::-1]:
              if visit[i]:
                     continue
              __UpperCAmelCase    							=[]
              dfsa(A_		)
              scc.append(A_		)
       return scc


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

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

   __A  							=  []
   __A  							=  [False] * n
   __A  							=  []
   __A  							=  []
   print(kosaraju())












from collections import defaultdict







def 			lowercase__  (				A_:	int = 5		)  ->							int:







       """simple docstring"""






       __UpperCAmelCase    							=defaultdict(A_		)
       __UpperCAmelCase    							=0

       while True:
              __UpperCAmelCase    							=get_digits(A_		)
              freqs[digits].append(A_		)

              if len(freqs[digits]		) == max_base:
                     __UpperCAmelCase    							=freqs[digits][0] ** 3
                     return base

              num += 1







def 			lowercase__  (				A_:	int		)  ->							str:







       """simple docstring"""






       return "".join(sorted(str(num**3		)		)		)


if __name__ == "__main__":
   print(F"""{solution() = }""")




