
'''simple docstring'''
from collections import deque







def 							A_  (    __SCREAMING_SNAKE_CASE    :	Any			)					->							Union[str, Any]:





  """simple docstring"""

  return input(__SCREAMING_SNAKE_CASE			).strip().split(""" """			)







def 							A_  (    __SCREAMING_SNAKE_CASE    :	int      ,  __SCREAMING_SNAKE_CASE    :	int			)					->							dict[int, list[int]]:





  """simple docstring"""

  __A		:  dict[int, list[int]]       				=		{}
  for i in range(__SCREAMING_SNAKE_CASE			):
    __A		:  Optional[Any]       				=		[]

  for e in range(__SCREAMING_SNAKE_CASE			):
    __A				,       __A		:  Tuple       				=		(int(__SCREAMING_SNAKE_CASE			) for i in _input(F"Edge {e + 1}: <node1> <node2> "			))
    graph[x].append(__SCREAMING_SNAKE_CASE			)
  return graph







def 							A_  (    __SCREAMING_SNAKE_CASE    :	int      ,  __SCREAMING_SNAKE_CASE    :	int			)					->							dict[int, list[int]]:





  """simple docstring"""

  __A		:  dict[int, list[int]]       				=		{}
  for i in range(__SCREAMING_SNAKE_CASE			):
    __A		:  Optional[int]       				=		[]

  for e in range(__SCREAMING_SNAKE_CASE			):
    __A				,       __A		:  List[str]       				=		(int(__SCREAMING_SNAKE_CASE			) for i in _input(F"Edge {e + 1}: <node1> <node2> "			))
    graph[x].append(__SCREAMING_SNAKE_CASE			)
    graph[y].append(__SCREAMING_SNAKE_CASE			)
  return graph







def 							A_  (    __SCREAMING_SNAKE_CASE    :	int      ,  __SCREAMING_SNAKE_CASE    :	int			)					->							dict[int, list[tuple[int, int]]]:





  """simple docstring"""

  __A		:  dict[int, list[tuple[int, int]]]       				=		{}
  for i in range(__SCREAMING_SNAKE_CASE			):
    __A		:  List[str]       				=		[]

  for e in range(__SCREAMING_SNAKE_CASE			):
    __A				,       __A				,       __A		:  List[str]       				=		(int(__SCREAMING_SNAKE_CASE			) for i in _input(F"Edge {e + 1}: <node1> <node2> <weight> "			))
    graph[x].append((y, w)			)
    graph[y].append((x, w)			)
  return graph


if __name__ == "__main__":
     A__		,   A__ :		str					=(int(i) for i in _input('Number of nodes and edges: '))

     A__ :		Optional[Any]					=int(
         _input(
             'Press 1 or 2 or 3 \n'
             '1. Unweighted directed \n'
             '2. Unweighted undirected \n'
             '3. Weighted undirected \n'
         )[0]
     )

     A__ :		Tuple					={
         1: initialize_unweighted_directed_graph,
         2: initialize_unweighted_undirected_graph,
         3: initialize_weighted_undirected_graph,
     }[graph_choice](n, m)







def 							A_  (    __SCREAMING_SNAKE_CASE    :	int      ,  __SCREAMING_SNAKE_CASE    :	str			)					->							List[Any]:





  """simple docstring"""

  __A				,       __A		:  Union[str, Any]       				=		{s}, [s]
  print(__SCREAMING_SNAKE_CASE			)
  while _s:
    __A		:  Dict       				=		0
    for i in g[_s[-1]]:
      if i not in vis:
        _s.append(__SCREAMING_SNAKE_CASE			)
        vis.add(__SCREAMING_SNAKE_CASE			)
        __A		:  List[Any]       				=		1
        print(__SCREAMING_SNAKE_CASE			)
        break
    if not flag:
      _s.pop()







def 							A_  (    __SCREAMING_SNAKE_CASE    :	List[str]      ,  __SCREAMING_SNAKE_CASE    :	Optional[int]			)					->							List[Any]:





  """simple docstring"""

  __A				,       __A		:  int       				=		{s}, deque([s]			)
  print(__SCREAMING_SNAKE_CASE			)
  while q:
    __A		:  Optional[Any]       				=		q.popleft()
    for v in g[u]:
      if v not in vis:
        vis.add(__SCREAMING_SNAKE_CASE			)
        q.append(__SCREAMING_SNAKE_CASE			)
        print(__SCREAMING_SNAKE_CASE			)







def 							A_  (    __SCREAMING_SNAKE_CASE    :	List[Any]      ,  __SCREAMING_SNAKE_CASE    :	str			)					->							Dict:





  """simple docstring"""

  __A				,       __A				,       __A		:  Tuple       				=		{s: 0}, set(), {s: 0}
  while True:
    if len(__SCREAMING_SNAKE_CASE			) == len(__SCREAMING_SNAKE_CASE			) - 1:
      break
    __A		:  Optional[Any]       				=		10_0000
    for i in dist:
      if i not in known and dist[i] < mini:
        __A		:  Tuple       				=		dist[i]
        __A		:  Union[str, Any]       				=		i
    known.add(__SCREAMING_SNAKE_CASE			)
    for v in g[u]:
      if v[0] not in known and dist[u] + v[1] < dist.get(v[0]      ,  10_0000			):
        __A		:  Any       				=		dist[u] + v[1]
        __A		:  Tuple       				=		u
  for i in dist:
    if i != s:
      print(dist[i]			)







def 							A_  (    __SCREAMING_SNAKE_CASE    :	List[str]      ,  __SCREAMING_SNAKE_CASE    :	str=None      ,  __SCREAMING_SNAKE_CASE    :	List[Any]=None			)					->							str:





  """simple docstring"""

  if q is None:
    __A		:  Tuple       				=		[1]
  if ind is None:
    __A		:  Tuple       				=		[0] * (len(__SCREAMING_SNAKE_CASE			) + 1)  # SInce oth Index is ignored
    for u in g:
      for v in g[u]:
        ind[v] += 1
    __A		:  Union[str, Any]       				=		deque()
    for i in g:
      if ind[i] == 0:
        q.append(__SCREAMING_SNAKE_CASE			)
  if len(__SCREAMING_SNAKE_CASE			) == 0:
    return
  __A		:  Optional[Any]       				=		q.popleft()
  print(__SCREAMING_SNAKE_CASE			)
  for w in g[v]:
    ind[w] -= 1
    if ind[w] == 0:
      q.append(__SCREAMING_SNAKE_CASE			)
  topo(__SCREAMING_SNAKE_CASE      ,  __SCREAMING_SNAKE_CASE      ,  __SCREAMING_SNAKE_CASE			)







def 							A_  (    )					->							Union[str, Any]:





  """simple docstring"""

  __A		:  int       				=		input().strip()
  __A		:  Tuple       				=		[]
  for _ in range(__SCREAMING_SNAKE_CASE			):
    a.append(map(__SCREAMING_SNAKE_CASE      ,  input().strip().split()			)			)
  return a, n







def 							A_  (    __SCREAMING_SNAKE_CASE    :	Union[str, Any]			)					->							Any:





  """simple docstring"""

  ((__A)				,       (__A))		:  str       				=		a_and_n
  __A		:  Any       				=		list(__SCREAMING_SNAKE_CASE			)
  __A		:  Tuple       				=		[[0] * n for i in range(__SCREAMING_SNAKE_CASE			)]
  for k in range(__SCREAMING_SNAKE_CASE			):
    for i in range(__SCREAMING_SNAKE_CASE			):
      for j in range(__SCREAMING_SNAKE_CASE			):
        if dist[i][j] > dist[i][k] + dist[k][j]:
          __A		:  Optional[Any]       				=		dist[i][k] + dist[k][j]
          __A		:  Any       				=		k
  print(__SCREAMING_SNAKE_CASE			)







def 							A_  (    __SCREAMING_SNAKE_CASE    :	Tuple      ,  __SCREAMING_SNAKE_CASE    :	List[Any]			)					->							List[Any]:





  """simple docstring"""

  __A				,       __A				,       __A		:  Optional[Any]       				=		{s: 0}, set(), {s: 0}
  while True:
    if len(__SCREAMING_SNAKE_CASE			) == len(__SCREAMING_SNAKE_CASE			) - 1:
      break
    __A		:  Optional[Any]       				=		10_0000
    for i in dist:
      if i not in known and dist[i] < mini:
        __A		:  Dict       				=		dist[i]
        __A		:  Optional[int]       				=		i
    known.add(__SCREAMING_SNAKE_CASE			)
    for v in g[u]:
      if v[0] not in known and v[1] < dist.get(v[0]      ,  10_0000			):
        __A		:  Optional[int]       				=		v[1]
        __A		:  str       				=		u
  return dist







def 							A_  (    )					->							List[Any]:





  """simple docstring"""

  __A				,       __A		:  str       				=		map(__SCREAMING_SNAKE_CASE      ,  input().split(""" """			)			)
  __A		:  Union[str, Any]       				=		[]
  for _ in range(__SCREAMING_SNAKE_CASE			):
    edges.append(map(__SCREAMING_SNAKE_CASE      ,  input().split(""" """			)			)			)
  return edges, n







def 							A_  (    __SCREAMING_SNAKE_CASE    :	Any			)					->							Union[str, Any]:





  """simple docstring"""

  ((__A)				,       (__A))		:  Any       				=		e_and_n
  e.sort(reverse=__SCREAMING_SNAKE_CASE      ,  key=lambda __SCREAMING_SNAKE_CASE			: x[2]			)
  __A		:  List[str]       				=		[{i} for i in range(1      ,  n + 1			)]
  while True:
    if len(__SCREAMING_SNAKE_CASE			) == 1:
      break
    print(__SCREAMING_SNAKE_CASE			)
    __A		:  List[str]       				=		e.pop()
    for i in range(len(__SCREAMING_SNAKE_CASE			)			):
      if x[0] in s[i]:
        break
    for j in range(len(__SCREAMING_SNAKE_CASE			)			):
      if x[1] in s[j]:
        if i == j:
          break
        s[j].update(s[i]			)
        s.pop(__SCREAMING_SNAKE_CASE			)
        break







def 							A_  (    __SCREAMING_SNAKE_CASE    :	Optional[int]			)					->							Any:





  """simple docstring"""

  __A		:  Optional[int]       				=		[]
  for node in graph:
    if not graph[node]:
      isolated.append(__SCREAMING_SNAKE_CASE			)
  return isolated





'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







class 			__A					(			_SCREAMING_SNAKE_CASE      ):
 lowerCamelCase												=['''image_processor''', '''tokenizer''']
 lowerCamelCase												='''EfficientNetImageProcessor'''
 lowerCamelCase												=('''BertTokenizer''', '''BertTokenizerFast''')
 def __init__( self      :     str					, lowerCamelCase      :     Optional[int]					, lowerCamelCase      :     Tuple							):



   """simple docstring"""





   super().__init__(lowerCamelCase					, lowerCamelCase							)
 def __call__( self      :     Tuple					, lowerCamelCase      :     str=None					, lowerCamelCase      :     Tuple=None					, lowerCamelCase      :     int="max_length"					, lowerCamelCase      :     int=64					, lowerCamelCase      :     Union[str, Any]=None					, **lowerCamelCase      :     Dict							):



   """simple docstring"""





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

   if text is not None:
     __A		:  str       				=		self.tokenizer(
         lowerCamelCase					, padding=lowerCamelCase					, max_length=lowerCamelCase					, return_tensors=lowerCamelCase					, **lowerCamelCase							)

   if images is not None:
     __A		:  Optional[Any]       				=		self.image_processor(lowerCamelCase					, return_tensors=lowerCamelCase					, **lowerCamelCase							)

   if text is not None and images is not None:
     __A		:  Optional[int]       				=		image_features.pixel_values
     return encoding
   elif text is not None:
     return encoding
   else:
     return BatchEncoding(data=dict(**lowerCamelCase							)					, tensor_type=lowerCamelCase							)
 def 		lowercase_( self      :     Any					, *lowerCamelCase      :     Optional[Any]					, **lowerCamelCase      :     Union[str, Any]							):



   """simple docstring"""





   return self.tokenizer.batch_decode(*lowerCamelCase					, **lowerCamelCase							)
 def 		lowercase_( self      :     Any					, *lowerCamelCase      :     List[Any]					, **lowerCamelCase      :     Union[str, Any]							):



   """simple docstring"""





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






 @property
 def 		lowercase_( self      :     int							):



   """simple docstring"""





   __A		:  Dict       				=		self.tokenizer.model_input_names
   __A		:  int       				=		self.image_processor.model_input_names
   return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)



