code: 
  
  
  
  
  
  
  def        UpperCAmelCase      (   _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      _lowercase     =	len(_lowercase      )
      # Create a stack and push index of fist element to it
      _lowercase     =	[]
      st.append(0      )
  
      # Span value of first element is always 1
      _lowercase     =	1
  
      # Calculate span values for rest of the elements
      for i in range(1,      _lowercase      ):
          # Pop elements from stack while stack is not
          # empty and top of stack is smaller than price[i]
          while len(_lowercase      ) > 0 and price[st[0]] <= price[i]:
              st.pop()
  
          # If stack becomes empty, then price[i] is greater
          # than all elements on left of it, i.e. price[0],
          # price[1], ..price[i-1]. Else the price[i]  is
          # greater than elements after top of stack
          _lowercase     =	i + 1 if len(_lowercase      ) <= 0 else (i - st[0])
  
          # Push this element to stack
          st.append(_lowercase      )
  def        UpperCAmelCase      (   _lowercase,      _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      for i in range(0,      _lowercase      ):
          print(arr[i],      end=' '      )
  
  
  # Driver program to test above function
  lowerCamelCase										=  [10, 4, 5, 90, 120, 80]
  lowerCamelCase										=  [0 for i in range(len(price) + 1)]
  
  # Fill the span values in array S[]
  calculation_span(price, S)
  print_array(S, len(price))
  
style_context: 
  
  
  
  
  
  
  from __future__ import annotations
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      global graph, reversed_graph, scc, component, visit, stack
      if visit[u]:
          return
      _lowercase     =	True
      for v in graph[u]:
          dfs(_lowercase      )
      stack.append(_lowercase      )
  def        UpperCAmelCase      (   _lowercase      ):
  
  
      '''simple docstring'''
  
  
  
      global graph, reversed_graph, scc, component, visit, stack
      if visit[u]:
          return
      _lowercase     =	True
      component.append(_lowercase      )
      for v in reversed_graph[u]:
          dfsa(_lowercase      )
  def        UpperCAmelCase      (   ):
  
  
      '''simple docstring'''
  
  
  
      global graph, reversed_graph, scc, component, visit, stack
      for i in range(_lowercase      ):
          dfs(_lowercase      )
      _lowercase     =	[False] * n
      for i in stack[::-1]:
          if visit[i]:
              continue
          _lowercase     =	[]
          dfsa(_lowercase      )
          scc.append(_lowercase      )
      return scc
  
  
  if __name__ == "__main__":
     # n - no of nodes, m - no of edges
     lowerCamelCase						,		lowerCamelCase										=  list(map(int, input().strip().split()))
  
     lowerCamelCase										=  [[] for _ in range(n)]  # graph
     lowerCamelCase										=  [[] for i in range(n)]  # reversed graph
     # input graph data (edges)
     for _ in range(m):
        lowerCamelCase						,		lowerCamelCase										=  list(map(int, input().strip().split()))
        graph[u].append(v)
        reversed_graph[v].append(u)
  
     lowerCamelCase										=  []
     lowerCamelCase										=  [False] * n
     lowerCamelCase										=  []
     lowerCamelCase										=  []
     print(kosaraju())
  