






import os
import sys
from contextlib import contextmanager


# Windows only
if os.name == "nt":
 import ctypes
 import msvcrt  # noqa


 class     _a							(	ctypes.Structure     ):






   """simple docstring"""





   A_						       = [("""size""", ctypes.c_int), ("""visible""", ctypes.c_byte)]






def      _snake_case     ():
   if os.name == "nt":
      UpperCamelCase_						=  CursorInfo()
      UpperCamelCase_						=  ctypes.windll.kernelaa.GetStdHandle(-11)
      ctypes.windll.kernelaa.GetConsoleCursorInfo(__lowercase     ,   ctypes.byref(__lowercase))
      UpperCamelCase_						=  False
      ctypes.windll.kernelaa.SetConsoleCursorInfo(__lowercase     ,   ctypes.byref(__lowercase))
   elif os.name == "posix":
      sys.stdout.write('\033[?25l')
      sys.stdout.flush()






def      _snake_case     ():
   if os.name == "nt":
      UpperCamelCase_						=  CursorInfo()
      UpperCamelCase_						=  ctypes.windll.kernelaa.GetStdHandle(-11)
      ctypes.windll.kernelaa.GetConsoleCursorInfo(__lowercase     ,   ctypes.byref(__lowercase))
      UpperCamelCase_						=  True
      ctypes.windll.kernelaa.SetConsoleCursorInfo(__lowercase     ,   ctypes.byref(__lowercase))
   elif os.name == "posix":
      sys.stdout.write('\033[?25h')
      sys.stdout.flush()






@contextmanager
def      _snake_case     ():
   try:
      hide_cursor()
      yield
   finally:
      show_cursor()









class     __UpperCAmelCase							:


     """simple docstring"""


     def __init__(	self  ,       __A    ):
        __a					=  set_counts
        __a					=  max(__A    )
        __a					=  len(__A    )
        __a					=  [1] * num_sets
        __a					=  list(range(__A    )    )


     def 	snake_case_  (	self  ,       __A  ,       __A    ):
        __a					=  self.get_parent(__A    )
        __a					=  self.get_parent(__A    )

        if src_parent == dst_parent:
           return False

        if self.ranks[dst_parent] >= self.ranks[src_parent]:
           self.set_counts[dst_parent] += self.set_counts[src_parent]
           __a					=  0
           __a					=  dst_parent
           if self.ranks[dst_parent] == self.ranks[src_parent]:
              self.ranks[dst_parent] += 1
           __a					=  self.set_counts[dst_parent]
        else:
           self.set_counts[src_parent] += self.set_counts[dst_parent]
           __a					=  0
           __a					=  src_parent
           __a					=  self.set_counts[src_parent]

        __a					=  max(self.max_set  ,       __A    )
        return True


     def 	snake_case_  (	self  ,       __A    ):
        if self.parents[disj_set] == disj_set:
           return disj_set
        __a					=  self.get_parent(self.parents[disj_set]    )
        return self.parents[disj_set]



