import math
import os

import cva
import numpy as np

_SCREAMING_SNAKE_CASE   		=			2_5_5.0





def  lowercase(  UpperCamelCase_       ,				UpperCamelCase_					)		->  float:







 '''simple docstring'''
 UpperCamelCase      =			np.mean((original - contrast) ** 2					)
 if mse == 0:
  return 100

 return 20 * math.logaa(PIXEL_MAX / math.sqrt(UpperCamelCase_					)					)





def  lowercase(  )		->  None:







 '''simple docstring'''
 UpperCamelCase      =			os.path.dirname(os.path.realpath(UpperCamelCase_					)					)
 # Loading images (original image and compressed image)
 UpperCamelCase      =			cva.imread(os.path.join(UpperCamelCase_       ,				"""image_data/original_image.png"""					)					)
 UpperCamelCase      =			cva.imread(os.path.join(UpperCamelCase_       ,				"""image_data/compressed_image.png"""					)       ,				1					)

 UpperCamelCase      =			cva.imread(os.path.join(UpperCamelCase_       ,				"""image_data/PSNR-example-base.png"""					)					)
 UpperCamelCase      =			cva.imread(
     os.path.join(UpperCamelCase_       ,				"""image_data/PSNR-example-comp-10.jpg"""					)       ,				1					)

 # Value expected: 29.73dB
 print("""-- First Test --"""					)
 print(f"""PSNR value is {peak_signal_to_noise_ratio(UpperCamelCase_       ,				UpperCamelCase_					)} dB"""					)

 # # Value expected: 31.53dB (Wikipedia Example)
 print("""\n-- Second Test --"""					)
 print(f"""PSNR value is {peak_signal_to_noise_ratio(UpperCamelCase_       ,				UpperCamelCase_					)} dB"""					)


if __name__ == "__main__":
     main()

from __future__ import annotations





def  lowercase(  UpperCamelCase_					)		->  Dict:







 '''simple docstring'''
 global graph, reversed_graph, scc, component, visit, stack
 if visit[u]:
  return
 UpperCamelCase      =			True
 for v in graph[u]:
  dfs(UpperCamelCase_					)
 stack.append(UpperCamelCase_					)





def  lowercase(  UpperCamelCase_					)		->  Optional[int]:







 '''simple docstring'''
 global graph, reversed_graph, scc, component, visit, stack
 if visit[u]:
  return
 UpperCamelCase      =			True
 component.append(UpperCamelCase_					)
 for v in reversed_graph[u]:
  dfsa(UpperCamelCase_					)





def  lowercase(  )		->  Any:







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


if __name__ == "__main__":
     # n - no of nodes, m - no of edges
     _SCREAMING_SNAKE_CASE		,  _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		,  _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())
