






"""simple docstring"""







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







class  lowerCamelCase__ :






    def __init__(			self     ,A ):
          UpperCAmelCase          =	str(id_ )
          UpperCAmelCase          =	None
          UpperCAmelCase          =	None
          UpperCAmelCase          =	[]
          UpperCAmelCase          =	{}  # {vertex:distance}






    def __lt__(			self     ,A ):
          return self.key < other.key






    def __repr__(			self ):
          return self.id






    def     _UpperCamelCase							(			self     ,A ):
          self.neighbors.append(_a )






    def     _UpperCamelCase							(			self     ,A     ,A ):
          UpperCAmelCase          =	weight







def _a			(		_snake_case				,	_snake_case				,	_snake_case				,	_snake_case							):







      """simple docstring"""






      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 _a			(		_snake_case				,	_snake_case							):







      """simple docstring"""






      UpperCAmelCase          =	[]
      for u in graph:
            UpperCAmelCase          =	math.inf
            UpperCAmelCase          =	None
      UpperCAmelCase          =	0
      UpperCAmelCase          =	graph[:]
      while q:
            UpperCAmelCase          =	min(__a							)
            q.remove(__a							)
            for v in u.neighbors:
                  if (v in q) and (u.edges[v.id] < v.key):
                        UpperCAmelCase          =	u
                        UpperCAmelCase          =	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 _a			(		_snake_case				,	_snake_case							):







      """simple docstring"""






      for u in graph:
            UpperCAmelCase          =	math.inf
            UpperCAmelCase          =	None
      UpperCAmelCase          =	0

      UpperCAmelCase          =	list(__a							)
      hq.heapify(__a							)

      while h:
            UpperCAmelCase          =	hq.heappop(__a							)
            for v in u.neighbors:
                  if (v in h) and (u.edges[v.id] < v.key):
                        UpperCAmelCase          =	u
                        UpperCAmelCase          =	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 _a			(		):







      """simple docstring"""









if __name__ == "__main__":
  import doctest

  doctest.testmod()











"""simple docstring"""







from __future__ import annotations

def _a			(		_snake_case				,	_snake_case				,	_snake_case							):







      """simple docstring"""






      if (voltage, current, resistance).count(0							) != 1:
            raise ValueError("""One and only one argument must be 0"""							)
      if resistance < 0:
            raise ValueError("""Resistance cannot be negative"""							)
      if voltage == 0:
            return {"voltage": float(current * resistance							)}
      elif current == 0:
            return {"current": voltage / resistance}
      elif resistance == 0:
            return {"resistance": voltage / current}
      else:
            raise ValueError("""Exactly one argument must be 0"""							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()



