
import copy

from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto.configuration_auto import AutoConfig
from ..clip.configuration_clip import CLIPVisionConfig


SCREAMING_SNAKE_CASE		:List[Any]				  =    logging.get_logger(__name__)






class 	__magic_name__				(       snake_case							):
     UpperCamelCase_  :int								=			"""vision-text-dual-encoder"""
     UpperCamelCase_  :int								=			True






     def __init__(							self		,	_lowercase=512		,	_lowercase=2.6_592		,	**_lowercase  )->    List[str]:
         super().__init__(**_lowercase  )

         if "vision_config" not in kwargs:
             raise ValueError("`vision_config` can not be `None`."  )

         if "text_config" not in kwargs:
             raise ValueError("`text_config` can not be `None`."  )

         UpperCamelCase_      =	kwargs.pop("vision_config"  )
         UpperCamelCase_      =	kwargs.pop("text_config"  )

         UpperCamelCase_      =	vision_config.pop("model_type"  )
         UpperCamelCase_      =	text_config.pop("model_type"  )

         if vision_model_type == "clip":
             UpperCamelCase_      =	AutoConfig.for_model(_lowercase		,	**_lowercase  ).vision_config
         elif vision_model_type == "clip_vision_model":
             UpperCamelCase_      =	CLIPVisionConfig(**_lowercase  )
         else:
             UpperCamelCase_      =	AutoConfig.for_model(_lowercase		,	**_lowercase  )

         UpperCamelCase_      =	AutoConfig.for_model(_lowercase		,	**_lowercase  )

         UpperCamelCase_      =	projection_dim
         UpperCamelCase_      =	logit_scale_init_value






     @classmethod
     def   UpperCAmelCase_							(							cls		,	_lowercase		,	_lowercase		,	**_lowercase  )->    List[Any]:
         return cls(vision_config=vision_config.to_dict()		,	text_config=text_config.to_dict()		,	**_lowercase  )






     def   UpperCAmelCase_							(							self  )->    Dict:
         UpperCamelCase_      =	copy.deepcopy(self.__dict__  )
         UpperCamelCase_      =	self.vision_config.to_dict()
         UpperCamelCase_      =	self.text_config.to_dict()
         UpperCamelCase_      =	self.__class__.model_type
         return output



from __future__ import annotations




def  lowerCAmelCase(			SCREAMING_SNAKE_CASE_ )->	str:



    """simple docstring"""






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




def  lowerCAmelCase(			SCREAMING_SNAKE_CASE_ )->	Dict:



    """simple docstring"""






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




def  lowerCAmelCase(			)->	Dict:



    """simple docstring"""






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


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

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

 SCREAMING_SNAKE_CASE		:list[int]				  =    []
 SCREAMING_SNAKE_CASE		:list[bool]				  =    [False] * n
 SCREAMING_SNAKE_CASE		:list[int]				  =    []
 SCREAMING_SNAKE_CASE		:list[int]				  =    []
 print(kosaraju())
