
from __future__ import annotations




def 		A_	(							snake_case							:				Tuple	) ->      Optional[int]:



						'''simple docstring'''

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




def 		A_	(							snake_case							:				str	) ->      str:



						'''simple docstring'''

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




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



						'''simple docstring'''

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


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

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

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






import torch

from transformers import PreTrainedModel

from .custom_configuration import CustomConfig, NoSuperInitConfig






class     SCREAMING_SNAKE_CASE__      (							SCREAMING_SNAKE_CASE_      ):

							"""simple docstring"""






							_snake_case       						=					CustomConfig



							def __init__(					self       ,		SCREAMING_SNAKE_CASE_     )->				Tuple:





													'''simple docstring'''






													super().__init__(SCREAMING_SNAKE_CASE_     )
													__UpperCamelCase       					=     torch.nn.Linear(config.hidden_size       ,		config.hidden_size     )



							def       A__						(					self       ,		SCREAMING_SNAKE_CASE_     )->				List[str]:





													'''simple docstring'''






													return self.linear(SCREAMING_SNAKE_CASE_     )



							def       A__						(					self       ,		SCREAMING_SNAKE_CASE_     )->				Any:





													'''simple docstring'''






													pass






class     SCREAMING_SNAKE_CASE__      (							SCREAMING_SNAKE_CASE_      ):

							"""simple docstring"""






							_snake_case       						=					NoSuperInitConfig



							def __init__(					self       ,		SCREAMING_SNAKE_CASE_     )->				Tuple:





													'''simple docstring'''






													super().__init__(SCREAMING_SNAKE_CASE_     )
													__UpperCamelCase       					=     torch.nn.Linear(config.attribute       ,		config.attribute     )



							def       A__						(					self       ,		SCREAMING_SNAKE_CASE_     )->				List[str]:





													'''simple docstring'''






													return self.linear(SCREAMING_SNAKE_CASE_     )



							def       A__						(					self       ,		SCREAMING_SNAKE_CASE_     )->				Union[str, Any]:





													'''simple docstring'''






													pass




