



'''simple docstring'''





from __future__ import annotations




def lowerCAmelCase  (__A):



     """simple docstring"""



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




def lowerCAmelCase  (__A):



     """simple docstring"""



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




def lowerCAmelCase  ():



     """simple docstring"""



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


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

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

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








'''simple docstring'''





import os
from string import ascii_letters

lowercase_			=  ascii_letters + " \t\n"




def lowerCAmelCase  ():



     """simple docstring"""



     _a     =  os.path.split(os.path.realpath(__A))
     _a     =  {}
     with open(path[0] + '''/dictionary.txt''') as dictionary_file:
          for word in dictionary_file.read().split('''\n'''):
               _a     =  None
     return english_words


lowercase_			=  load_dictionary()




def lowerCAmelCase  (__A):



     """simple docstring"""



     _a     =  message.upper()
     _a     =  remove_non_letters(__A)
     _a     =  message.split()
     _a     =  len([word for word in possible_words if word in ENGLISH_WORDS])
     return float(__A) / len(__A)




def lowerCAmelCase  (__A):



     """simple docstring"""



     return "".join(symbol for symbol in message if symbol in LETTERS_AND_SPACE)




def lowerCAmelCase  (__A  ,     __A = 20  ,     __A = 85):



     """simple docstring"""



     _a     =  get_english_count(__A) * 100 >= word_percentage
     _a     =  len(remove_non_letters(__A))
     _a     =  (float(__A) / len(__A)) * 100
     _a     =  message_letters_percentage >= letter_percentage
     return words_match and letters_match


if __name__ == "__main__":
  import doctest

  doctest.testmod()



