code: from collections import deque
  def 		snake_case__  (		lowercase				)     ->   str:
     return input(lowercase_				).strip().split(" "				)
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   dict[int, list[int]]:
     lowerCAmelCase_:       dict[int, list[int]]         =  {}
     for i in range(lowercase_				):
        lowerCAmelCase_:       Union[str, Any]         =  []
  
     for e in range(lowercase_				):
        lowerCAmelCase_:       int         =  (int(lowercase_				) for i in _input(F'''Edge {e + 1}: <node1> <node2> '''				))
        graph[x].append(lowercase_				)
     return graph
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   dict[int, list[int]]:
     lowerCAmelCase_:       dict[int, list[int]]         =  {}
     for i in range(lowercase_				):
        lowerCAmelCase_:       Union[str, Any]         =  []
  
     for e in range(lowercase_				):
        lowerCAmelCase_:       Tuple         =  (int(lowercase_				) for i in _input(F'''Edge {e + 1}: <node1> <node2> '''				))
        graph[x].append(lowercase_				)
        graph[y].append(lowercase_				)
     return graph
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   dict[int, list[tuple[int, int]]]:
     lowerCAmelCase_:       dict[int, list[tuple[int, int]]]         =  {}
     for i in range(lowercase_				):
        lowerCAmelCase_:       Dict         =  []
  
     for e in range(lowercase_				):
        lowerCAmelCase_:       str         =  (int(lowercase_				) 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     :			Dict					    =						(int(i) for i in _input("""Number of nodes and edges: """))
  
   a     :			int					    =						int(
       _input(
           """Press 1 or 2 or 3 \n"""
           """1. Unweighted directed \n"""
           """2. Unweighted undirected \n"""
           """3. Weighted undirected \n"""
       )[0]
   )
  
   a     :			List[str]					    =						{
       1: initialize_unweighted_directed_graph,
       2: initialize_unweighted_undirected_graph,
       3: initialize_weighted_undirected_graph,
   }[graph_choice](n, m)
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   Dict:
     lowerCAmelCase_:       Optional[Any]         =  {s}, [s]
     print(lowercase_				)
     while _s:
        lowerCAmelCase_:       Optional[int]         =  0
        for i in g[_s[-1]]:
           if i not in vis:
              _s.append(lowercase_				)
              vis.add(lowercase_				)
              lowerCAmelCase_:       Union[str, Any]         =  1
              print(lowercase_				)
              break
        if not flag:
           _s.pop()
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   str:
     lowerCAmelCase_:       List[str]         =  {s}, deque([s]				)
     print(lowercase_				)
     while q:
        lowerCAmelCase_:       Any         =  q.popleft()
        for v in g[u]:
           if v not in vis:
              vis.add(lowercase_				)
              q.append(lowercase_				)
              print(lowercase_				)
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   List[Any]:
     lowerCAmelCase_:       Optional[int]         =  {s: 0}, set(), {s: 0}
     while True:
        if len(lowercase_				) == len(lowercase_				) - 1:
           break
        lowerCAmelCase_:       Optional[Any]         =  100000
        for i in dist:
           if i not in known and dist[i] < mini:
              lowerCAmelCase_:       Optional[Any]         =  dist[i]
              lowerCAmelCase_:       Dict         =  i
        known.add(lowercase_				)
        for v in g[u]:
           if v[0] not in known and dist[u] + v[1] < dist.get(v[0]       ,							100000				):
              lowerCAmelCase_:       List[str]         =  dist[u] + v[1]
              lowerCAmelCase_:       List[Any]         =  u
     for i in dist:
        if i != s:
           print(dist[i]				)
  def 		snake_case__  (		lowercase       ,							lowercase=None       ,							lowercase=None				)     ->   Dict:
     if q is None:
        lowerCAmelCase_:       Optional[Any]         =  [1]
     if ind is None:
        lowerCAmelCase_:       int         =  [0] * (len(lowercase_				) + 1)  # SInce oth Index is ignored
        for u in g:
           for v in g[u]:
              ind[v] += 1
        lowerCAmelCase_:       Optional[Any]         =  deque()
        for i in g:
           if ind[i] == 0:
              q.append(lowercase_				)
     if len(lowercase_				) == 0:
        return
     lowerCAmelCase_:       str         =  q.popleft()
     print(lowercase_				)
     for w in g[v]:
        ind[w] -= 1
        if ind[w] == 0:
           q.append(lowercase_				)
     topo(lowercase_       ,							lowercase_       ,							lowercase_				)
  def 		snake_case__  (		)     ->   Any:
     lowerCAmelCase_:       List[Any]         =  input().strip()
     lowerCAmelCase_:       Dict         =  []
     for _ in range(lowercase_				):
        a.append(map(lowercase_       ,							input().strip().split()				)				)
     return a, n
  def 		snake_case__  (		lowercase				)     ->   int:
     (lowerCAmelCase_):       Any         =  a_and_n
     lowerCAmelCase_:       List[Any]         =  list(lowercase_				)
     lowerCAmelCase_:       str         =  [[0] * n for i in range(lowercase_				)]
     for k in range(lowercase_				):
        for i in range(lowercase_				):
           for j in range(lowercase_				):
              if dist[i][j] > dist[i][k] + dist[k][j]:
                 lowerCAmelCase_:       Tuple         =  dist[i][k] + dist[k][j]
                 lowerCAmelCase_:       str         =  k
     print(lowercase_				)
  def 		snake_case__  (		lowercase       ,							lowercase				)     ->   int:
     lowerCAmelCase_:       Union[str, Any]         =  {s: 0}, set(), {s: 0}
     while True:
        if len(lowercase_				) == len(lowercase_				) - 1:
           break
        lowerCAmelCase_:       Union[str, Any]         =  100000
        for i in dist:
           if i not in known and dist[i] < mini:
              lowerCAmelCase_:       Optional[Any]         =  dist[i]
              lowerCAmelCase_:       List[str]         =  i
        known.add(lowercase_				)
        for v in g[u]:
           if v[0] not in known and v[1] < dist.get(v[0]       ,							100000				):
              lowerCAmelCase_:       Dict         =  v[1]
              lowerCAmelCase_:       Optional[Any]         =  u
     return dist
  def 		snake_case__  (		)     ->   Tuple:
     lowerCAmelCase_:       List[Any]         =  map(lowercase_       ,							input().split(" "				)				)
     lowerCAmelCase_:       List[Any]         =  []
     for _ in range(lowercase_				):
        edges.append(map(lowercase_       ,							input().split(" "				)				)				)
     return edges, n
  def 		snake_case__  (		lowercase				)     ->   str:
     # Sort edges on the basis of distance
     (lowerCAmelCase_):       List[str]         =  e_and_n
     e.sort(reverse=lowercase_       ,							key=lambda lowercase				: x[2]				)
     lowerCAmelCase_:       List[Any]         =  [{i} for i in range(1       ,							n + 1				)]
     while True:
        if len(lowercase_				) == 1:
           break
        print(lowercase_				)
        lowerCAmelCase_:       Any         =  e.pop()
        for i in range(len(lowercase_				)				):
           if x[0] in s[i]:
              break
        for j in range(len(lowercase_				)				):
           if x[1] in s[j]:
              if i == j:
                 break
              s[j].update(s[i]				)
              s.pop(lowercase_				)
              break
  
  
  
  
  
  
  
  def 		snake_case__  (		lowercase				)     ->   int:
     lowerCAmelCase_:       List[Any]         =  []
     for node in graph:
        if not graph[node]:
           isolated.append(lowercase_				)
     return isolated
style_context: from ctypes import c_float, sizeof
  from enum import Enum
  from typing import TYPE_CHECKING, Optional, Union
  
  
  if TYPE_CHECKING:
   from .. import AutoFeatureExtractor, AutoProcessor, AutoTokenizer  # tests_ignore
  
  class 				_lowercase						(    UpperCAmelCase__ ):
  
  
  
  
  
  
      '''simple docstring'''
      SCREAMING_SNAKE_CASE:							Union[str, Any]        =						c_float
  
  
  
  
      @property
      def     _a						(						self   ):
         return sizeof(self.value   )
  
  
  
  
  
  def 		snake_case__  (		lowercase       ,							lowercase       ,							lowercase = 0				):
     # < 0 is possible if using a dynamic axis
     if dimension <= 0:
        lowerCAmelCase_:       int         =  fixed_dimension
  
     dimension -= num_token_to_add
     return dimension
  def 		snake_case__  (		lowercase       ,							lowercase				):
     return num_parameters * dtype.size
  
  
  
  
  
  
  
  def 		snake_case__  (		lowercase				):
     from .. import AutoFeatureExtractor, AutoProcessor, AutoTokenizer  # tests_ignore
  
     try:
        return AutoProcessor.from_pretrained(lowercase				)
     except (ValueError, OSError, KeyError):
        lowerCAmelCase_     ,  lowerCAmelCase_:       int         =  None, None
        try:
           lowerCAmelCase_:       Dict         =  AutoTokenizer.from_pretrained(lowercase				)
        except (OSError, KeyError):
           pass
        try:
           lowerCAmelCase_:       Optional[int]         =  AutoFeatureExtractor.from_pretrained(lowercase				)
        except (OSError, KeyError):
           pass
  
        if tokenizer is not None and feature_extractor is not None:
           raise ValueError(
               F'''Couldn\'t auto-detect preprocessor for {model_name}. Found both a tokenizer and a feature extractor.'''				)
        elif tokenizer is None and feature_extractor is None:
           return None
        elif tokenizer is not None:
           return tokenizer
        else:
           return feature_extractor