




from __future__ import annotations





def      UpperCAmelCase  (						UpperCamelCase__   )     ->     str:







				'''simple docstring'''


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





def      UpperCAmelCase  (						UpperCamelCase__   )     ->     str:







				'''simple docstring'''


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





def      UpperCAmelCase  (						)     ->     Any:







				'''simple docstring'''


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


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

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

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






from ..utils import deprecate
from .attention_processor import (  # noqa: F401
    Attention,
    AttentionProcessor,
    AttnAddedKVProcessor,
    AttnProcessor2_0,
    LoRAAttnProcessor,
    LoRALinearLayer,
    LoRAXFormersAttnProcessor,
    SlicedAttnAddedKVProcessor,
    SlicedAttnProcessor,
    XFormersAttnProcessor,
)
from .attention_processor import AttnProcessor as AttnProcessorRename  # noqa: F401


deprecate(
    'cross_attention',
    '0.20.0',
    'Importing from cross_attention is deprecated. Please import from diffusers.models.attention_processor instead.',
    standard_warn=False,
)


snake_case__						      =			AttentionProcessor



class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

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






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					List[Any]:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					Optional[int]:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					Optional[int]:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					Tuple:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					int:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					Optional[int]:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )





class 			UpperCamelCase					(			__lowercase			):

     '''simple docstring'''

     def __init__(       self					,					*A_					,					**A_    )			->					Dict:






           """simple docstring"""
           _lowerCamelCase           =					F'{self.__class__.__name__} is deprecated and will be removed in `0.20.0`. Please use `from diffusers.models.attention_processor import {"".join(self.__class__.__name__.split("Cross"    )    )} instead.'
           deprecate('''cross_attention'''					,					'''0.20.0'''					,					A_					,					standard_warn=A_    )
           super().__init__(*A_					,					**A_    )