






from collections import deque

def      __snake_case						(					_lowerCAmelCase : str	) ->						List[Any]:
   return input(__lowerCamelCase	).strip().split(" "	)

def      __snake_case						(					_lowerCAmelCase : Any				,				_lowerCAmelCase : Optional[int]	) ->						dict[int, list[int]]:
   A_					:				dict[int, list[int]]          =			{}
   for i in range(__lowerCamelCase	):
      A_					:				Union[str, Any]          =			[]

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

def      __snake_case						(					_lowerCAmelCase : Union[str, Any]				,				_lowerCAmelCase : Tuple	) ->						dict[int, list[int]]:
   A_					:				dict[int, list[int]]          =			{}
   for i in range(__lowerCamelCase	):
      A_					:				Union[str, Any]          =			[]

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

def      __snake_case						(					_lowerCAmelCase : List[Any]				,				_lowerCAmelCase : Union[str, Any]	) ->						dict[int, list[tuple[int, int]]]:
   A_					:				dict[int, list[tuple[int, int]]]          =			{}
   for i in range(__lowerCamelCase	):
      A_					:				str          =			[]

   for e in range(__lowerCamelCase	):
      A_					:				Dict          =			(int(__lowerCamelCase	) 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							:      Optional[int]						=	(int(i) for i in _input('''Number of nodes and edges: '''))

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

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

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

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

def      __snake_case						(					_lowerCAmelCase : str				,				_lowerCAmelCase : Tuple	) ->						Tuple:
   A_					:				int          =			{s: 0}, set(), {s: 0}
   while True:
      if len(__lowerCamelCase	) == len(__lowerCamelCase	) - 1:
         break
      A_					:				Any          =			100000
      for i in dist:
         if i not in known and dist[i] < mini:
            A_					:				List[str]          =			dist[i]
            A_					:				Dict          =			i
      known.add(__lowerCamelCase	)
      for v in g[u]:
         if v[0] not in known and dist[u] + v[1] < dist.get(v[0]				,				100000	):
            A_					:				int          =			dist[u] + v[1]
            A_					:				Tuple          =			u
   for i in dist:
      if i != s:
         print(dist[i]	)

def      __snake_case						(					_lowerCAmelCase : List[str]				,				_lowerCAmelCase : Optional[int]=None				,				_lowerCAmelCase : Optional[int]=None	) ->						Union[str, Any]:
   if q is None:
      A_					:				List[Any]          =			[1]
   if ind is None:
      A_					:				Dict          =			[0] * (len(__lowerCamelCase	) + 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(__lowerCamelCase	)
   if len(__lowerCamelCase	) == 0:
      return
   A_					:				List[str]          =			q.popleft()
   print(__lowerCamelCase	)
   for w in g[v]:
      ind[w] -= 1
      if ind[w] == 0:
         q.append(__lowerCamelCase	)
   topo(__lowerCamelCase				,				__lowerCamelCase				,				__lowerCamelCase	)

def      __snake_case						(					) ->						str:
   A_					:				List[Any]          =			input().strip()
   A_					:				Tuple          =			[]
   for _ in range(__lowerCamelCase	):
      a.append(map(__lowerCamelCase				,				input().strip().split()	)	)
   return a, n

def      __snake_case						(					_lowerCAmelCase : Dict	) ->						Tuple:
   (A_)					:				Optional[Any]          =			a_and_n
   A_					:				Any          =			list(__lowerCamelCase	)
   A_					:				Any          =			[[0] * n for i in range(__lowerCamelCase	)]
   for k in range(__lowerCamelCase	):
      for i in range(__lowerCamelCase	):
         for j in range(__lowerCamelCase	):
            if dist[i][j] > dist[i][k] + dist[k][j]:
               A_					:				List[str]          =			dist[i][k] + dist[k][j]
               A_					:				Optional[Any]          =			k
   print(__lowerCamelCase	)

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

def      __snake_case						(					) ->						List[str]:
   A_					:				Union[str, Any]          =			map(__lowerCamelCase				,				input().split(" "	)	)
   A_					:				List[str]          =			[]
   for _ in range(__lowerCamelCase	):
      edges.append(map(__lowerCamelCase				,				input().split(" "	)	)	)
   return edges, n

def      __snake_case						(					_lowerCAmelCase : Any	) ->						Optional[int]:
   (A_)					:				int          =			e_and_n
   e.sort(reverse=__lowerCamelCase				,				key=lambda _lowerCAmelCase	: x[2]	)
   A_					:				str          =			[{i} for i in range(1				,				n + 1	)]
   while True:
      if len(__lowerCamelCase	) == 1:
         break
      print(__lowerCamelCase	)
      A_					:				Tuple          =			e.pop()
      for i in range(len(__lowerCamelCase	)	):
         if x[0] in s[i]:
            break
      for j in range(len(__lowerCamelCase	)	):
         if x[1] in s[j]:
            if i == j:
               break
            s[j].update(s[i]	)
            s.pop(__lowerCamelCase	)
            break





def      __snake_case						(					_lowerCAmelCase : Tuple	) ->						Union[str, Any]:
   A_					:				Optional[Any]          =			[]
   for node in graph:
      if not graph[node]:
         isolated.append(__lowerCamelCase	)
   return isolated







def      __snake_case						(					_lowerCAmelCase : float				,				_lowerCAmelCase : float				,				_lowerCAmelCase : int	) ->						float:
   A_					:				List[str]          =			[1 / first_term]
   A_					:				Tuple          =			1 / first_term
   for _ in range(number_of_terms - 1	):
      first_term += common_difference
      arithmetic_progression.append(_lowerCAmelCase	)
   A_					:				List[str]          =			[1 / step for step in arithmetic_progression]
   return sum(_lowerCAmelCase	)


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 print(sum_of_harmonic_progression(1 / 2, 2, 2))
