

from __future__ import annotations

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     str       )      ->				Tuple:
				global graph, reversed_graph, scc, component, visit, stack
				if visit[u]:
								return
				_UpperCAmelCase				:						List[str]       						=			True
				for v in graph[u]:
								dfs(_lowerCamelCase       )
				stack.append(_lowerCamelCase       )

def 							__SCREAMING_SNAKE_CASE							( lowerCAmelCase:     Union[str, Any]       )      ->				Dict:
				global graph, reversed_graph, scc, component, visit, stack
				if visit[u]:
								return
				_UpperCAmelCase				:						Tuple       						=			True
				component.append(_lowerCamelCase       )
				for v in reversed_graph[u]:
								dfsa(_lowerCamelCase       )

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


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

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

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










"""simple docstring"""
from cva import destroyAllWindows, imread, imshow, waitKey






def        lowerCamelCase_  (						_lowerCamelCase			,   _lowerCamelCase				):
 lowerCamelCase__				,     lowerCamelCase__     :			Optional[Any]     				=						img.shape[0], img.shape[1]

 def to_grayscale(_lowerCamelCase			,   _lowerCamelCase			,   _lowerCamelCase				):
  return 0.2_126 * red + 0.587 * green + 0.114 * blue

 def normalize(_lowerCamelCase				):
  return min(_lowerCamelCase			,   255				)

 for i in range(_lowerCamelCase				):
  for j in range(_lowerCamelCase				):
   lowerCamelCase__     :			List[Any]     				=						int(to_grayscale(*img[i][j]				)				)
   lowerCamelCase__     :			Optional[int]     				=						[
       normalize(_lowerCamelCase				),
       normalize(greyscale + factor				),
       normalize(greyscale + 2 * factor				),
   ]

 return img


if __name__ == "__main__":
      # read original image
      A_			: List[str]				=			{
          percentage: imread("image_data/lena.jpg", 1) for percentage in (10, 20, 30, 40)
      }

      for percentage, img in images.items():
            make_sepia(img, percentage)

      for percentage, img in images.items():
            imshow(f"Original image with sepia (factor: {percentage})", img)

      waitKey(0)
      destroyAllWindows()

