
from __future__ import annotations






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






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






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


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

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

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



def 							UpperCAmelCase_		(							__SCREAMING_SNAKE_CASE							):
	lowercase					  =   [701, 301, 132, 57, 23, 10, 4, 1]
	for gap in gaps:
		for i in range(__SCREAMING_SNAKE_CASE			,							len(__SCREAMING_SNAKE_CASE							)							):
			lowercase					  =   collection[i]
			lowercase					  =   i
			while j >= gap and collection[j - gap] > insert_value:
				lowercase					  =   collection[j - gap]
				j -= gap
			if j != i:
				lowercase					  =   insert_value
	return collection


if __name__ == "__main__":
	from doctest import testmod

	testmod()
	UpperCAmelCase     				=			input('''Enter numbers separated by a comma:\n''').strip()
	UpperCAmelCase     				=			[int(item) for item in user_input.split(''',''')]
	print(shell_sort(unsorted))

