


from __future__ import annotations


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  Any:
						global graph, reversed_graph, scc, component, visit, stack
						if visit[u]:
												return
						_a     =			True
						for v in graph[u]:
												dfs(_UpperCAmelCase				)
						stack.append(_UpperCAmelCase				)


def 							SCREAMING_SNAKE_CASE					(  _UpperCAmelCase				)    ->  Any:
						global graph, reversed_graph, scc, component, visit, stack
						if visit[u]:
												return
						_a     =			True
						component.append(_UpperCAmelCase				)
						for v in reversed_graph[u]:
												dfsa(_UpperCAmelCase				)


def 							SCREAMING_SNAKE_CASE					(  )    ->  int:
						global graph, reversed_graph, scc, component, visit, stack
						for i in range(_UpperCAmelCase				):
												dfs(_UpperCAmelCase				)
						_a     =			[False] * n
						for i in stack[::-1]:
												if visit[i]:
																		continue
												_a     =			[]
												dfsa(_UpperCAmelCase				)
												scc.append(_UpperCAmelCase				)
						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())






lowercase_								=    [0.485, 0.456, 0.406]
lowercase_								=    [0.229, 0.224, 0.225]
lowercase_								=    [0.5, 0.5, 0.5]
lowercase_								=    [0.5, 0.5, 0.5]
lowercase_								=    [0.48145466, 0.4578275, 0.40821073]
lowercase_								=    [0.26862954, 0.26130258, 0.27577711]


