

from collections import deque

def      a__	(						UpperCAmelCase				:     Union[str, Any]     )    ->		Tuple:
  return input(UpperCAmelCase     ).strip().split(''' '''     )

def      a__	(						UpperCAmelCase				:     int							,					UpperCAmelCase				:     int     )    ->		dict[int, list[int]]:
  UpperCAmelCase			:				dict[int, list[int]]										=					{}
  for i in range(UpperCAmelCase     ):
    UpperCAmelCase			:				List[str]										=					[]

  for e in range(UpperCAmelCase     ):
    UpperCAmelCase			:				List[str]										=					(int(UpperCAmelCase     ) for i in _input(f'''Edge {e + 1}: <node1> <node2> '''     ))
    graph[x].append(UpperCAmelCase     )
  return graph

def      a__	(						UpperCAmelCase				:     int							,					UpperCAmelCase				:     int     )    ->		dict[int, list[int]]:
  UpperCAmelCase			:				dict[int, list[int]]										=					{}
  for i in range(UpperCAmelCase     ):
    UpperCAmelCase			:				List[str]										=					[]

  for e in range(UpperCAmelCase     ):
    UpperCAmelCase			:				Any										=					(int(UpperCAmelCase     ) for i in _input(f'''Edge {e + 1}: <node1> <node2> '''     ))
    graph[x].append(UpperCAmelCase     )
    graph[y].append(UpperCAmelCase     )
  return graph

def      a__	(						UpperCAmelCase				:     int							,					UpperCAmelCase				:     int     )    ->		dict[int, list[tuple[int, int]]]:
  UpperCAmelCase			:				dict[int, list[tuple[int, int]]]										=					{}
  for i in range(UpperCAmelCase     ):
    UpperCAmelCase			:				Dict										=					[]

  for e in range(UpperCAmelCase     ):
    UpperCAmelCase			:				Optional[Any]										=					(int(UpperCAmelCase     ) 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__":
     _lowerCamelCase							:  Dict     =				(int(i) for i in _input("Number of nodes and edges: "))

     _lowerCamelCase							:  Union[str, Any]     =				int(
         _input(
             "Press 1 or 2 or 3 \n"
             "1. Unweighted directed \n"
             "2. Unweighted undirected \n"
             "3. Weighted undirected \n"
         )[0]
     )

     _lowerCamelCase							:  Optional[int]     =				{
         1: initialize_unweighted_directed_graph,
         2: initialize_unweighted_undirected_graph,
         3: initialize_weighted_undirected_graph,
     }[graph_choice](n, m)

def      a__	(						UpperCAmelCase				:     Union[str, Any]							,					UpperCAmelCase				:     Any     )    ->		Optional[int]:
  UpperCAmelCase			:				Dict										=					{s}, [s]
  print(UpperCAmelCase     )
  while _s:
    UpperCAmelCase			:				Optional[Any]										=					0
    for i in g[_s[-1]]:
      if i not in vis:
        _s.append(UpperCAmelCase     )
        vis.add(UpperCAmelCase     )
        UpperCAmelCase			:				Optional[int]										=					1
        print(UpperCAmelCase     )
        break
    if not flag:
      _s.pop()

def      a__	(						UpperCAmelCase				:     List[str]							,					UpperCAmelCase				:     Optional[int]     )    ->		int:
  UpperCAmelCase			:				Optional[Any]										=					{s}, deque([s]     )
  print(UpperCAmelCase     )
  while q:
    UpperCAmelCase			:				str										=					q.popleft()
    for v in g[u]:
      if v not in vis:
        vis.add(UpperCAmelCase     )
        q.append(UpperCAmelCase     )
        print(UpperCAmelCase     )

def      a__	(						UpperCAmelCase				:     List[str]							,					UpperCAmelCase				:     List[Any]     )    ->		List[Any]:
  UpperCAmelCase			:				List[str]										=					{s: 0}, set(), {s: 0}
  while True:
    if len(UpperCAmelCase     ) == len(UpperCAmelCase     ) - 1:
      break
    UpperCAmelCase			:				List[Any]										=					100_000
    for i in dist:
      if i not in known and dist[i] < mini:
        UpperCAmelCase			:				Optional[Any]										=					dist[i]
        UpperCAmelCase			:				List[Any]										=					i
    known.add(UpperCAmelCase     )
    for v in g[u]:
      if v[0] not in known and dist[u] + v[1] < dist.get(v[0]							,					100_000     ):
        UpperCAmelCase			:				Union[str, Any]										=					dist[u] + v[1]
        UpperCAmelCase			:				str										=					u
  for i in dist:
    if i != s:
      print(dist[i]     )

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

def      a__	(						)    ->		Optional[Any]:
  UpperCAmelCase			:				Union[str, Any]										=					input().strip()
  UpperCAmelCase			:				str										=					[]
  for _ in range(UpperCAmelCase     ):
    a.append(map(UpperCAmelCase							,					input().strip().split()     )     )
  return a, n

def      a__	(						UpperCAmelCase				:     Union[str, Any]     )    ->		Union[str, Any]:
  (UpperCAmelCase)			:				List[Any]										=					a_and_n
  UpperCAmelCase			:				Tuple										=					list(UpperCAmelCase     )
  UpperCAmelCase			:				Any										=					[[0] * n for i in range(UpperCAmelCase     )]
  for k in range(UpperCAmelCase     ):
    for i in range(UpperCAmelCase     ):
      for j in range(UpperCAmelCase     ):
        if dist[i][j] > dist[i][k] + dist[k][j]:
          UpperCAmelCase			:				List[str]										=					dist[i][k] + dist[k][j]
          UpperCAmelCase			:				Any										=					k
  print(UpperCAmelCase     )

def      a__	(						UpperCAmelCase				:     Optional[Any]							,					UpperCAmelCase				:     Optional[Any]     )    ->		Any:
  UpperCAmelCase			:				List[Any]										=					{s: 0}, set(), {s: 0}
  while True:
    if len(UpperCAmelCase     ) == len(UpperCAmelCase     ) - 1:
      break
    UpperCAmelCase			:				Any										=					100_000
    for i in dist:
      if i not in known and dist[i] < mini:
        UpperCAmelCase			:				int										=					dist[i]
        UpperCAmelCase			:				Tuple										=					i
    known.add(UpperCAmelCase     )
    for v in g[u]:
      if v[0] not in known and v[1] < dist.get(v[0]							,					100_000     ):
        UpperCAmelCase			:				Optional[int]										=					v[1]
        UpperCAmelCase			:				str										=					u
  return dist

def      a__	(						)    ->		Union[str, Any]:
  UpperCAmelCase			:				Optional[int]										=					map(UpperCAmelCase							,					input().split(''' '''     )     )
  UpperCAmelCase			:				List[str]										=					[]
  for _ in range(UpperCAmelCase     ):
    edges.append(map(UpperCAmelCase							,					input().split(''' '''     )     )     )
  return edges, n

def      a__	(						UpperCAmelCase				:     Optional[int]     )    ->		str:
  # Sort edges on the basis of distance
  (UpperCAmelCase)			:				Dict										=					e_and_n
  e.sort(reverse=UpperCAmelCase							,					key=lambda UpperCAmelCase     : x[2]     )
  UpperCAmelCase			:				Union[str, Any]										=					[{i} for i in range(1							,					n + 1     )]
  while True:
    if len(UpperCAmelCase     ) == 1:
      break
    print(UpperCAmelCase     )
    UpperCAmelCase			:				List[Any]										=					e.pop()
    for i in range(len(UpperCAmelCase     )     ):
      if x[0] in s[i]:
        break
    for j in range(len(UpperCAmelCase     )     ):
      if x[1] in s[j]:
        if i == j:
          break
        s[j].update(s[i]     )
        s.pop(UpperCAmelCase     )
        break






def      a__	(						UpperCAmelCase				:     Optional[Any]     )    ->		Dict:
  UpperCAmelCase			:				Dict										=					[]
  for node in graph:
    if not graph[node]:
      isolated.append(UpperCAmelCase     )
  return isolated









_A		:					Optional[int]          =							{
    '''+''': lambda x, y: x + y,
    '''-''': lambda x, y: x - y,
    '''*''': lambda x, y: x * y,
    '''/''': lambda x, y: x / y,
}



def      __lowerCAmelCase    (				snake_case						:     Union[str, Any]			)							->				str:
   return c.isdigit()



def      __lowerCAmelCase    (				snake_case						:     Optional[Any]			)							->				str:
   __lowerCamelCase:					List[str]	 =						[]

   # iterate over the string in reverse order
   for c in expression.split()[::-1]:
      # push operand to stack
      if is_operand(snake_case			):
         stack.append(int(snake_case			)			)

      else:
         # pop values from stack can calculate the result
         # push the result onto the stack again
         __lowerCamelCase:					Any	 =						stack.pop()
         __lowerCamelCase:					int	 =						stack.pop()
         stack.append(calc[c](snake_case    ,   snake_case			)			)

   return stack.pop()


# Driver code
if __name__ == "__main__":
   _A		:					int          =							'''+ 9 * 2 6'''
   print(evaluate(test_expression))

   _A		:					str          =							'''/ * 10 2 + 4 1 '''
   print(evaluate(test_expression))


