


import unittest

from cer import CER


_A							     =       CER()

class 			lowerCamelCase_					(    unittest.TestCase    ):





							def   __magic_name__      (							self    ):
								a_     			=   ["""White House"""]
								a_     			=   ["""white house"""]
								# S = 2, D = 0, I = 0, N = 11, CER = 2 / 11
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.1_8_1_8_1_8_1_8_1_8    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""were wolf"""]
								a_     			=   ["""werewolf"""]
								# S = 0, D = 0, I = 1, N = 9, CER = 1 / 9
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.1_1_1_1_1_1_1    ) < 1E-6    )

								a_     			=   ["""werewolf"""]
								a_     			=   ["""weae     wolf"""]
								# S = 1, D = 1, I = 0, N = 8, CER = 0.25
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.2_5    ) < 1E-6    )

								# consecutive whitespaces case 1
								a_     			=   ["""were wolf"""]
								a_     			=   ["""were               wolf"""]
								# S = 0, D = 0, I = 0, N = 9, CER = 0
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.0    ) < 1E-6    )

								# consecutive whitespaces case 2
								a_     			=   ["""were   wolf"""]
								a_     			=   ["""were               wolf"""]
								# S = 0, D = 0, I = 0, N = 9, CER = 0
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.0    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""werewolf"""]
								a_     			=   ["""weaewolf"""]
								# S = 1, D = 0, I = 0, N = 8, CER = 0.125
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.1_2_5    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""werewolf"""]
								a_     			=   ["""wereawolf"""]
								# S = 0, D = 1, I = 0, N = 8, CER = 0.125
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.1_2_5    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""werewolf"""]
								a_     			=   ["""wereolf"""]
								# S = 0, D = 0, I = 1, N = 8, CER = 0.125
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.1_2_5    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""werewolf"""]
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertEqual(_SCREAMING_SNAKE_CASE			,       0.0    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""werewolf""", """I am your father"""]
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertEqual(_SCREAMING_SNAKE_CASE			,       0.0    )

								a_     			=   ["""werewolf""", """I am your father""", """doge"""]
								a_     			=   ["""werxwolf""", """I       am your father""", """doge"""]
								# S = 1, D = 0, I = 0, N = 28, CER = 1 / 28
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.0_3_5_7_1_4_2_8    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""My hovercraft""", """is full of eels"""]
								a_     			=   ["""My hovercraft is full""", """ of eels"""]
								# S = 0, D = 0, I = 2, N = 28, CER = 2 / 28
								# whitespace at the front of " of eels" will be strip during preporcessing
								# so need to insert 2 whitespaces
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE			,       concatenate_texts=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.0_7_1_4_2_8    ) < 1E-6    )





							def   __magic_name__      (							self    ):
								a_     			=   ["""我能吞下玻璃而不伤身体"""]
								a_     			=   [""" 能吞虾玻璃而 不霜身体啦"""]
								# S = 3, D = 2, I = 0, N = 11, CER = 5 / 11
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.4_5_4_5_4_5_4_5_4_5    ) < 1E-6    )

								a_     			=   ["""我能吞下玻璃""", """而不伤身体"""]
								a_     			=   ["""我    能 吞 下 玻 璃""", """而不伤身体"""]
								# S = 0, D = 5, I = 0, N = 11, CER = 5 / 11
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertTrue(abs(char_error_rate - 0.4_5_4_5_4_5_4_5_4_5_4_5    ) < 1E-6    )

								a_     			=   ["""我能吞下玻璃而不伤身体"""]
								a_     			=   cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )
								self.assertFalse(_SCREAMING_SNAKE_CASE			,       0.0    )





							def   __magic_name__      (							self    ):
								a_     			=   [""""""]
								a_     			=   ["""Hypothesis"""]
								with self.assertRaises(_SCREAMING_SNAKE_CASE    ):
									cer.compute(predictions=_SCREAMING_SNAKE_CASE			,       references=_SCREAMING_SNAKE_CASE    )


if __name__ == "__main__":
			unittest.main()



def 			__SCREAMING_SNAKE_CASE		(		UpperCamelCase		:      int     ,					UpperCamelCase		:      list[tuple[int, int, int]]	)     ->	list[tuple[int, int, int]]:



	"""simple docstring"""






	a_     			=   sorted(UpperCamelCase     ,					key=lambda UpperCamelCase	: edge[2]	)

	a_     			=   list(range(UpperCamelCase	)	)

	def find_parent(UpperCamelCase		:      Any	):
		if i != parent[i]:
			a_     			=   find_parent(parent[i]	)
		return parent[i]

	a_     			=   0
	a_     			=   []

	for edge in edges:
		a_     			=   find_parent(edge[0]	)
		a_     			=   find_parent(edge[1]	)
		if parent_a != parent_b:
			minimum_spanning_tree_cost += edge[2]
			minimum_spanning_tree.append(UpperCamelCase	)
			a_     			=   parent_b

	return minimum_spanning_tree


if __name__ == "__main__":  # pragma: no cover
			_A     ,				_A							     =       list(map(int, input().strip().split()))
			_A							     =       []

			for _ in range(num_edges):
						_A     ,				_A     ,				_A							     =       (int(x) for x in input().strip().split())
						edges.append((nodea, nodea, cost))

			kruskal(num_nodes, edges)