
"""simple docstring"""







import sys
from collections import defaultdict




class  A__       :

		def __init__(      self ):
			__lowerCAmelCase			:						Optional[Any]									=      []

		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE ):
			return self.node_position[vertex]

		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE ):
			__lowerCAmelCase			:						Union[str, Any]									=      pos

		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE ):
			if start > size // 2 - 1:
				return
			else:
				if 2 * start + 2 >= size:
					__lowerCAmelCase			:						Union[str, Any]									=      2 * start + 1
				else:
					if heap[2 * start + 1] < heap[2 * start + 2]:
						__lowerCAmelCase			:						str									=      2 * start + 1
					else:
						__lowerCAmelCase			:						Dict									=      2 * start + 2
				if heap[smallest_child] < heap[start]:
					__lowerCAmelCase			,   __lowerCAmelCase			:						str									=      heap[smallest_child], positions[smallest_child]
					__lowerCAmelCase			,   __lowerCAmelCase			:						Optional[int]									=      (
					    heap[start],
					    positions[start],
					)
					__lowerCAmelCase			,   __lowerCAmelCase			:						Any									=      temp, tempa

					__lowerCAmelCase			:						Dict									=      self.get_position(positions[smallest_child] )
					self.set_position(
					    positions[smallest_child]       ,		self.get_position(positions[start] ) )
					self.set_position(positions[start]       ,		_SCREAMING_SNAKE_CASE )

					self.top_to_bottom(_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE )

		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE ):
			__lowerCAmelCase			:						Any									=      position[index]

			while index != 0:
				__lowerCAmelCase			:						str									=      int((index - 2) / 2 ) if index % 2 == 0 else int((index - 1) / 2 )

				if val < heap[parent]:
					__lowerCAmelCase			:						Any									=      heap[parent]
					__lowerCAmelCase			:						Tuple									=      position[parent]
					self.set_position(position[parent]       ,		_SCREAMING_SNAKE_CASE )
				else:
					__lowerCAmelCase			:						str									=      val
					__lowerCAmelCase			:						Dict									=      temp
					self.set_position(_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE )
					break
				__lowerCAmelCase			:						str									=      parent
			else:
				__lowerCAmelCase			:						List[Any]									=      val
				__lowerCAmelCase			:						int									=      temp
				self.set_position(_SCREAMING_SNAKE_CASE       ,		0 )

		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE ):
			__lowerCAmelCase			:						Union[str, Any]									=      len(_SCREAMING_SNAKE_CASE ) // 2 - 1
			for i in range(_SCREAMING_SNAKE_CASE       ,		-1       ,		-1 ):
				self.top_to_bottom(_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE       ,		len(_SCREAMING_SNAKE_CASE )       ,		_SCREAMING_SNAKE_CASE )







		def 							__lowerCamelCase							(      self       ,		_SCREAMING_SNAKE_CASE       ,		_SCREAMING_SNAKE_CASE ):
			__lowerCAmelCase			:						Tuple									=      positions[0]
			__lowerCAmelCase			:						Optional[int]									=      sys.maxsize
			self.top_to_bottom(_SCREAMING_SNAKE_CASE       ,		0       ,		len(_SCREAMING_SNAKE_CASE )       ,		_SCREAMING_SNAKE_CASE )
			return temp



def     __lowerCAmelCase				(_UpperCamelCase		):
	__lowerCAmelCase			:						int									=      Heap()

	__lowerCAmelCase			:						str									=      [0] * len(_UpperCamelCase		)
	__lowerCAmelCase			:						int									=      [-1] * len(_UpperCamelCase		)  # Neighboring Tree Vertex of selected vertex
	# Minimum Distance of explored vertex with neighboring vertex of partial tree
	# formed in graph
	__lowerCAmelCase			:						List[str]									=      []  # Heap of Distance of vertices from their neighboring vertex
	__lowerCAmelCase			:						Tuple									=      []

	for vertex in range(len(_UpperCamelCase		)		):
		distance_tv.append(sys.maxsize		)
		positions.append(_UpperCamelCase		)
		heap.node_position.append(_UpperCamelCase		)

	__lowerCAmelCase			:						Any									=      []
	__lowerCAmelCase			:						List[str]									=      1
	__lowerCAmelCase			:						Optional[int]									=      sys.maxsize
	for neighbor, distance in adjacency_list[0]:
		__lowerCAmelCase			:						int									=      0
		__lowerCAmelCase			:						List[Any]									=      distance
	heap.heapify(_UpperCamelCase       ,  _UpperCamelCase		)

	for _ in range(1       ,  len(_UpperCamelCase		)		):
		__lowerCAmelCase			:						str									=      heap.delete_minimum(_UpperCamelCase       ,  _UpperCamelCase		)
		if visited[vertex] == 0:
			tree_edges.append((nbr_tv[vertex], vertex)		)
			__lowerCAmelCase			:						int									=      1
			for neighbor, distance in adjacency_list[vertex]:
				if (
				    visited[neighbor] == 0
				    and distance < distance_tv[heap.get_position(_UpperCamelCase		)]
				):
					__lowerCAmelCase			:						Tuple									=      distance
					heap.bottom_to_top(
					    _UpperCamelCase       ,  heap.get_position(_UpperCamelCase		)       ,  _UpperCamelCase       ,  _UpperCamelCase		)
					__lowerCAmelCase			:						str									=      vertex
	return tree_edges


if __name__ == "__main__":  # pragma: no cover
							# < --------- Prims Algorithm --------- >
							lowerCamelCase__   					=		int(input("""Enter number of edges: """).strip())
							lowerCamelCase__   					=		defaultdict(list)
							for _ in range(edges_number):
														lowerCamelCase__   					=		[int(x) for x in input().strip().split()]
														adjacency_list[edge[0]].append([edge[1], edge[2]])
														adjacency_list[edge[1]].append([edge[0], edge[2]])
							print(prisms_algorithm(adjacency_list))

import unittest

from transformers import AutoTokenizer, is_flax_available
from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow


if is_flax_available():
			import jax.numpy as jnp

			from transformers import FlaxXLMRobertaModel




@require_sentencepiece
@require_tokenizers
@require_flax
class    SCREAMING_SNAKE_CASE__     (	unittest.TestCase					):





	'''simple docstring'''



	@slow
	def  A							(  self	:    int	):


				'''simple docstring'''


				_snake_case		=			FlaxXLMRobertaModel.from_pretrained('xlm-roberta-base'	)
				_snake_case		=			AutoTokenizer.from_pretrained('xlm-roberta-base'	)
				_snake_case		=			'The dog is cute and lives in the garden house'
				_snake_case		=			jnp.array([tokenizer.encode(lowercase	)]	)

				_snake_case		=			(1, 12, 768)  # batch_size, sequence_length, embedding_vector_dim
				_snake_case		=			jnp.array(
				    [[-0.0101, 0.1218, -0.0803, 0.0801, 0.1327, 0.0776, -0.1215, 0.2383, 0.3338, 0.3106, 0.0300, 0.0252]]	)

				_snake_case		=			model(lowercase	)['last_hidden_state']
				self.assertEqual(output.shape			,  lowercase	)
				# compare the actual values for a slice of last dim
				self.assertTrue(jnp.allclose(output[:, :, -1]			,  lowercase			,  atol=1E-3	)	)