






import heapq as hq
import math
from collections.abc import Iterator


class    _lowerCAmelCase			:



				"""simple docstring"""



				def __init__(      self    :    Union[str, Any]			,		UpperCamelCase__    :    Dict):






											'''simple docstring'''







											snake_case__	  =       str(id_)
											snake_case__	  =       None
											snake_case__	  =       None
											snake_case__	  =       []
											snake_case__	  =       {}  # {vertex:distance}



				def __lt__(      self    :    List[str]			,		UpperCamelCase__    :    Tuple):






											'''simple docstring'''







											return self.key < other.key



				def __repr__(      self    :    List[Any]):






											'''simple docstring'''







											return self.id



				def 					__magic_name__							(      self    :    str			,		UpperCamelCase__    :    Any):






											'''simple docstring'''







											self.neighbors.append(UpperCamelCase__)



				def 					__magic_name__							(      self    :    Union[str, Any]			,		UpperCamelCase__    :    Optional[Any]			,		UpperCamelCase__    :    List[Any]):






											'''simple docstring'''







											snake_case__	  =       weight


def _UpperCAmelCase   (	a						:	Optional[int]  ,					a						:	Any  ,					a						:	Any  ,					a						:	Tuple ):
							# add the neighbors:
							graph[a - 1].add_neighbor(graph[b - 1] )
							graph[b - 1].add_neighbor(graph[a - 1] )
							# add the edges:
							graph[a - 1].add_edge(graph[b - 1]  ,					a )
							graph[b - 1].add_edge(graph[a - 1]  ,					a )

def _UpperCAmelCase   (	a						:	list  ,					a						:	Vertex ):
							snake_case__	  =       []
							for u in graph:
														snake_case__	  =       math.inf
														snake_case__	  =       None
							snake_case__	  =       0
							snake_case__	  =       graph[:]
							while q:
														snake_case__	  =       min(a )
														q.remove(a )
														for v in u.neighbors:
																					if (v in q) and (u.edges[v.id] < v.key):
																												snake_case__	  =       u
																												snake_case__	  =       u.edges[v.id]
							for i in range(1  ,					len(a ) ):
														a.append((int(graph[i].id ) + 1, int(graph[i].pi.id ) + 1) )
							return a

def _UpperCAmelCase   (	a						:	list  ,					a						:	Vertex ):
							for u in graph:
														snake_case__	  =       math.inf
														snake_case__	  =       None
							snake_case__	  =       0

							snake_case__	  =       list(a )
							hq.heapify(a )

							while h:
														snake_case__	  =       hq.heappop(a )
														for v in u.neighbors:
																					if (v in h) and (u.edges[v.id] < v.key):
																												snake_case__	  =       u
																												snake_case__	  =       u.edges[v.id]
																												hq.heapify(a )

							for i in range(1  ,					len(a ) ):
														yield (int(graph[i].id ) + 1, int(graph[i].pi.id ) + 1)

def _UpperCAmelCase   (	):
							pass


if __name__ == "__main__":
	import doctest

	doctest.testmod()








import random
from typing import Any

def _UpperCAmelCase   (	a						:	list ):
							for _ in range(len(a ) ):
														snake_case__	  =       random.randint(0  ,					len(a ) - 1 )
														snake_case__	  =       random.randint(0  ,					len(a ) - 1 )
														snake_case__  , snake_case__	  =       data[b], data[a]
							return data


if __name__ == "__main__":
	a__       =     [0, 1, 2, 3, 4, 5, 6, 7]
	a__       =     ["""python""", """says""", """hello""", """!"""]
	print("""Fisher-Yates Shuffle:""")
	print("""List""", integers, strings)
	print("""FY Shuffle""", fisher_yates_shuffle(integers), fisher_yates_shuffle(strings))
