






import unittest

from transformers import load_tool
from transformers.tools.agent_types import AGENT_TYPE_MAPPING

from .test_tools_common import ToolTesterMixin, output_types

class 					snake_case_							(       unittest.TestCase      ,			lowercase_      ):







   """simple docstring"""



   def 			SCREAMING_SNAKE_CASE__				(    self:	str	)  ->		Tuple:


       """simple docstring"""



       _lowercase     =	load_tool('translation'	)
       self.tool.setup()
       _lowercase     =	load_tool('translation'   ,       remote=snake_case__	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	List[Any]	)  ->		Dict:


       """simple docstring"""



       _lowercase     =	self.tool('Hey, what\'s up?'   ,       src_lang='English'   ,       tgt_lang='French'	)
       self.assertEqual(snake_case__   ,       '- Hé, comment ça va?'	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	List[Any]	)  ->		int:


       """simple docstring"""



       _lowercase     =	self.remote_tool('Hey, what\'s up?'   ,       src_lang='English'   ,       tgt_lang='French'	)
       self.assertEqual(snake_case__   ,       '- Hé, comment ça va?'	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	int	)  ->		Union[str, Any]:


       """simple docstring"""



       _lowercase     =	self.tool(text='Hey, what\'s up?'   ,       src_lang='English'   ,       tgt_lang='French'	)
       self.assertEqual(snake_case__   ,       '- Hé, comment ça va?'	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	int	)  ->		int:


       """simple docstring"""



       _lowercase     =	self.remote_tool(text='Hey, what\'s up?'   ,       src_lang='English'   ,       tgt_lang='French'	)
       self.assertEqual(snake_case__   ,       '- Hé, comment ça va?'	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	int	)  ->		str:


       """simple docstring"""



       _lowercase     =	['Hey, what\'s up?', 'English', 'Spanish']
       _lowercase     =	self.tool(*snake_case__	)

       # There is a single output
       if len(self.tool.outputs	) == 1:
           _lowercase     =	[outputs]

       self.assertListEqual(output_types(snake_case__	)   ,       self.tool.outputs	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	List[str]	)  ->		int:


       """simple docstring"""



       _lowercase     =	['Hey, what\'s up?', 'English', 'Spanish']
       _lowercase     =	self.tool(*snake_case__	)

       if not isinstance(snake_case__   ,       snake_case__	):
           _lowercase     =	[outputs]

       self.assertEqual(len(snake_case__	)   ,       len(self.tool.outputs	)	)

       for output, output_type in zip(snake_case__   ,       self.tool.outputs	):
           _lowercase     =	AGENT_TYPE_MAPPING[output_type]
           self.assertTrue(isinstance(snake_case__   ,       snake_case__	)	)

   def 			SCREAMING_SNAKE_CASE__				(    self:	Optional[Any]	)  ->		List[Any]:


       """simple docstring"""



       _lowercase     =	['Hey, what\'s up?', 'English', 'Spanish']

       _lowercase     =	[]

       for _input, input_type in zip(snake_case__   ,       self.tool.inputs	):
           if isinstance(snake_case__   ,       snake_case__	):
               _inputs.append([AGENT_TYPE_MAPPING[_input_type](_input	) for _input_type in input_type]	)
           else:
               _inputs.append(AGENT_TYPE_MAPPING[input_type](_input	)	)

        # Should not raise an error
       _lowercase     =	self.tool(*snake_case__	)

       if not isinstance(snake_case__   ,       snake_case__	):
           _lowercase     =	[outputs]

       self.assertEqual(len(snake_case__	)   ,       len(self.tool.outputs	)	)








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())
