import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class SCREAMING_SNAKE_CASE_		(			__lowerCAmelCase		):
   __lowerCAmelCase											=							["""image_processor""", """tokenizer"""]
   __lowerCAmelCase											=							"""VideoMAEImageProcessor"""
   __lowerCAmelCase											=							("""CLIPTokenizer""", """CLIPTokenizerFast""")







   def __init__(    self	:	Optional[Any]      ,      lowerCamelCase_	:	List[Any]=None      ,      lowerCamelCase_	:	Any=None      ,      **lowerCamelCase_	:	Dict							):





    """simple docstring"""


    UpperCamelCase      =			None
    if "feature_extractor" in kwargs:
     warnings.warn(
         """The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"""
         """ instead."""      ,      lowerCamelCase_      ,      )
     UpperCamelCase      =			kwargs.pop("""feature_extractor"""							)

    UpperCamelCase      =			image_processor if image_processor is not None else feature_extractor
    if image_processor is None:
     raise ValueError("""You need to specify an `image_processor`."""							)
    if tokenizer is None:
     raise ValueError("""You need to specify a `tokenizer`."""							)

    super().__init__(lowerCamelCase_      ,      lowerCamelCase_							)
    UpperCamelCase      =			self.image_processor







   def __call__(    self	:	Dict      ,      lowerCamelCase_	:	Optional[Any]=None      ,      lowerCamelCase_	:	int=None      ,      lowerCamelCase_	:	Optional[Any]=None      ,      **lowerCamelCase_	:	str							):





    """simple docstring"""


    if text is None and videos is None:
     raise ValueError("""You have to specify either text or videos. Both cannot be none."""							)

    if text is not None:
     UpperCamelCase      =			self.tokenizer(lowerCamelCase_      ,      return_tensors=lowerCamelCase_      ,      **lowerCamelCase_							)

    if videos is not None:
     UpperCamelCase      =			self.image_processor(lowerCamelCase_      ,      return_tensors=lowerCamelCase_      ,      **lowerCamelCase_							)

    if text is not None and videos is not None:
     UpperCamelCase      =			image_features.pixel_values
     return encoding
    elif text is not None:
     return encoding
    else:
     return BatchEncoding(data=dict(**lowerCamelCase_							)      ,      tensor_type=lowerCamelCase_							)







   def 	lowerCamelCase_  (    self	:	Optional[Any]      ,      *lowerCamelCase_	:	int      ,      **lowerCamelCase_	:	Union[str, Any]							):





    """simple docstring"""


    return self.tokenizer.batch_decode(*lowerCamelCase_      ,      **lowerCamelCase_							)







   def 	lowerCamelCase_  (    self	:	str      ,      *lowerCamelCase_	:	str      ,      **lowerCamelCase_	:	Union[str, Any]							):





    """simple docstring"""


    return self.tokenizer.decode(*lowerCamelCase_      ,      **lowerCamelCase_							)







   @property
   def 	lowerCamelCase_  (    self	:	Dict							):





    """simple docstring"""


    return ["input_ids", "attention_mask", "position_ids", "pixel_values"]







   @property
   def 	lowerCamelCase_  (    self	:	int							):





    """simple docstring"""


    warnings.warn(
        """`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."""      ,      lowerCamelCase_      ,      )
    return self.image_processor_class







   @property
   def 	lowerCamelCase_  (    self	:	int							):





    """simple docstring"""


    warnings.warn(
        """`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."""      ,      lowerCamelCase_      ,      )
    return self.image_processor

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