




"""simple docstring"""



def     _SCREAMING_SNAKE_CASE  (				lowercase_     ,					lowercase_		)		->						list[tuple[int, int, int]]:
 A__			=							sorted(lowercase_     ,					key=lambda lowercase_		: edge[2]		)

 A__			=							list(range(lowercase_		)		)

 def find_parent(lowercase_		):
  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(lowercase_		)
   A__			=							parent_b

 return minimum_spanning_tree


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

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

      kruskal(num_nodes, edges)











"""simple docstring"""



import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
      import torch

if is_vision_available():
      from PIL import Image

      from transformers import ViTImageProcessor




class       UpperCAmelCase_    (		unittest.TestCase				):




    def __init__(       self		:			Union[str, Any]      ,					snake_case_		:			Tuple      ,					snake_case_		:			Dict=7      ,					snake_case_		:			List[Any]=3      ,					snake_case_		:			Optional[int]=18      ,					snake_case_		:			Tuple=30      ,					snake_case_		:			Dict=400      ,					snake_case_		:			List[str]=True      ,					snake_case_		:			Optional[int]=None      ,					snake_case_		:			List[str]=True      ,					snake_case_		:			Optional[Any]=[0.5, 0.5, 0.5]      ,					snake_case_		:			Optional[int]=[0.5, 0.5, 0.5]      ,					) ->				List[Any]:




     '''simple docstring'''

     A__			=							size if size is not None else {"height": 18, "width": 18}
     A__			=							parent
     A__			=							batch_size
     A__			=							num_channels
     A__			=							image_size
     A__			=							min_resolution
     A__			=							max_resolution
     A__			=							do_resize
     A__			=							size
     A__			=							do_normalize
     A__			=							image_mean
     A__			=							image_std




    def 				__magic_name__				(       self		:			Union[str, Any] ) ->				Dict:




     '''simple docstring'''

     return {
         "image_mean": self.image_mean,
         "image_std": self.image_std,
         "do_normalize": self.do_normalize,
         "do_resize": self.do_resize,
         "size": self.size,
     }






@require_torch
@require_vision
class       UpperCAmelCase_    (		A_,  unittest.TestCase				):
    lowercase__		   = ViTImageProcessor if is_vision_available() else None




    def 				__magic_name__				(       self		:			int ) ->				Any:




     '''simple docstring'''

     A__			=							ViTImageProcessingTester(self )




    @property
    def 				__magic_name__				(       self		:			Optional[Any] ) ->				str:




     '''simple docstring'''

     return self.image_processor_tester.prepare_image_processor_dict()




    def 				__magic_name__				(       self		:			Tuple ) ->				str:




     '''simple docstring'''

     A__			=							self.image_processing_class(**self.image_processor_dict )
     self.assertTrue(hasattr(snake_case_      ,					"image_mean" ) )
     self.assertTrue(hasattr(snake_case_      ,					"image_std" ) )
     self.assertTrue(hasattr(snake_case_      ,					"do_normalize" ) )
     self.assertTrue(hasattr(snake_case_      ,					"do_resize" ) )
     self.assertTrue(hasattr(snake_case_      ,					"size" ) )




    def 				__magic_name__				(       self		:			Union[str, Any] ) ->				List[str]:




     '''simple docstring'''

     A__			=							self.image_processing_class.from_dict(self.image_processor_dict )
     self.assertEqual(image_processor.size      ,					{"height": 18, "width": 18} )

     A__			=							self.image_processing_class.from_dict(self.image_processor_dict      ,					size=42 )
     self.assertEqual(image_processor.size      ,					{"height": 42, "width": 42} )




    def 				__magic_name__				(       self		:			Any ) ->				Optional[Any]:




     '''simple docstring'''

     pass




    def 				__magic_name__				(       self		:			Optional[int] ) ->				Any:




     '''simple docstring'''

     A__			=							self.image_processing_class(**self.image_processor_dict )
     # create random PIL images
     A__			=							prepare_image_inputs(self.image_processor_tester      ,					equal_resolution=snake_case_ )
     for image in image_inputs:
      self.assertIsInstance(snake_case_      ,					Image.Image )

     # Test not batched input
     A__			=							image_processing(image_inputs[0]      ,					return_tensors="pt" ).pixel_values
     self.assertEqual(
         encoded_images.shape      ,					(
             1,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.size["height"],
             self.image_processor_tester.size["width"],
         )      ,					)

     # Test batched
     A__			=							image_processing(snake_case_      ,					return_tensors="pt" ).pixel_values
     self.assertEqual(
         encoded_images.shape      ,					(
             self.image_processor_tester.batch_size,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.size["height"],
             self.image_processor_tester.size["width"],
         )      ,					)




    def 				__magic_name__				(       self		:			str ) ->				Optional[Any]:




     '''simple docstring'''

     A__			=							self.image_processing_class(**self.image_processor_dict )
     # create random numpy tensors
     A__			=							prepare_image_inputs(self.image_processor_tester      ,					equal_resolution=snake_case_      ,					numpify=snake_case_ )
     for image in image_inputs:
      self.assertIsInstance(snake_case_      ,					np.ndarray )

     # Test not batched input
     A__			=							image_processing(image_inputs[0]      ,					return_tensors="pt" ).pixel_values
     self.assertEqual(
         encoded_images.shape      ,					(
             1,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.size["height"],
             self.image_processor_tester.size["width"],
         )      ,					)

     # Test batched
     A__			=							image_processing(snake_case_      ,					return_tensors="pt" ).pixel_values
     self.assertEqual(
         encoded_images.shape      ,					(
             self.image_processor_tester.batch_size,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.size["height"],
             self.image_processor_tester.size["width"],
         )      ,					)




    def 				__magic_name__				(       self		:			Dict ) ->				Union[str, Any]:




     '''simple docstring'''

     A__			=							self.image_processing_class(**self.image_processor_dict )
     # create random PyTorch tensors
     A__			=							prepare_image_inputs(self.image_processor_tester      ,					equal_resolution=snake_case_      ,					torchify=snake_case_ )
     for image in image_inputs:
      self.assertIsInstance(snake_case_      ,					torch.Tensor )

     # Test not batched input
     A__			=							image_processing(image_inputs[0]      ,					return_tensors="pt" ).pixel_values
     self.assertEqual(
         encoded_images.shape      ,					(
             1,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.size["height"],
             self.image_processor_tester.size["width"],
         )      ,					)

     # Test batched
     A__			=							image_processing(snake_case_      ,					return_tensors="pt" ).pixel_values
     self.assertEqual(
         encoded_images.shape      ,					(
             self.image_processor_tester.batch_size,
             self.image_processor_tester.num_channels,
             self.image_processor_tester.size["height"],
             self.image_processor_tester.size["width"],
         )      ,					)





