






"""simple docstring"""



from __future__ import annotations


def   SCREAMING_SNAKE_CASE__					(     snake_case					:   Any							)->		str:






     '''simple docstring'''



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


def   SCREAMING_SNAKE_CASE__					(     snake_case					:   List[Any]							)->		Optional[int]:






     '''simple docstring'''



     global graph, reversed_graph, scc, component, visit, stack
     if visit[u]:
          return
     UpperCAmelCase__	:						Union[str, Any]       =       True
     component.append(lowercase__							)
     for v in reversed_graph[u]:
          dfsa(lowercase__							)


def   SCREAMING_SNAKE_CASE__					(     )->		Any:






     '''simple docstring'''



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


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

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

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










"""simple docstring"""



def   SCREAMING_SNAKE_CASE__					(     snake_case					:   int							)->		list:






     '''simple docstring'''



     UpperCAmelCase__	:						List[str]       =       [True for i in range(n + 1							)]
     UpperCAmelCase__	:						List[str]       =       [i - 1 for i in range(n + 1							)]
     UpperCAmelCase__	:						int       =       []
     for i in range(2 ,				n + 1							):
          if is_prime[i]:
               primes.append(snake_case							)
          for j in range(0 ,				len(snake_case							)							):
               if i * primes[j] >= n:
                    break
               UpperCAmelCase__	:						Optional[Any]       =       False

               if i % primes[j] == 0:
                    UpperCAmelCase__	:						str       =       totients[i] * primes[j]
                    break

               UpperCAmelCase__	:						Union[str, Any]       =       totients[i] * (primes[j] - 1)

     return totients


if __name__ == "__main__":
 import doctest

 doctest.testmod()


