


'''simple docstring'''







class 				__lowerCamelCase				:
    """simple docstring"""


    def __init__(						self    :							Optional[int]   ,							SCREAMING_SNAKE_CASE    :							int):
           _A  :			str											=      data
           _A  :			int
           _A  :			Node






def    lowerCAmelCase__ (       lowerCamelCase  :    Node     ):
       _A  :			List[Any]											=      0
       _A  :			List[str]											=      x






def    lowerCAmelCase__ (       lowerCamelCase  :    Node						,lowerCamelCase  :    Node     ):
       _A						,				_A  :			Optional[Any]											=      find_set(lowerCamelCase     ), find_set(lowerCamelCase     )
       if x == y:
              return

       elif x.rank > y.rank:
              _A  :			Union[str, Any]											=      x
       else:
              _A  :			Optional[Any]											=      y
              if x.rank == y.rank:
                     y.rank += 1






def    lowerCAmelCase__ (       lowerCamelCase  :    Node     ):
       if x != x.parent:
              _A  :			Union[str, Any]											=      find_set(x.parent     )
       return x.parent






def    lowerCAmelCase__ (       lowerCamelCase  :    Node     ):
       _A  :			Union[str, Any]											=      ({0, 1, 2}, {3, 4, 5})
       for s in sets:
              if node.data in s:
                     return s
       _A  :			str											=      F'{node.data} is not in {sets}'
       raise ValueError(lowerCamelCase     )






def    lowerCAmelCase__ (       ):
       _A  :			str											=      [Node(lowerCamelCase     ) for i in range(6     )]
       for v in vertex:
              make_set(lowerCamelCase     )

       union_set(vertex[0]						,vertex[1]     )
       union_set(vertex[1]						,vertex[2]     )
       union_set(vertex[3]						,vertex[4]     )
       union_set(vertex[3]						,vertex[5]     )

       for nodea in vertex:
              for nodea in vertex:
                     if find_python_set(lowerCamelCase     ).isdisjoint(find_python_set(lowerCamelCase     )     ):
                            assert find_set(lowerCamelCase     ) != find_set(lowerCamelCase     )
                     else:
                            assert find_set(lowerCamelCase     ) == find_set(lowerCamelCase     )


if __name__ == "__main__":
   test_disjoint_set()










'''simple docstring'''







import itertools






def    lowerCAmelCase__ (       lowerCamelCase  :    int = 1000000     ):
       _A  :			str											=      [1]

       for i in itertools.count(len(lowerCamelCase     )     ):
              _A  :			Optional[Any]											=      0
              for j in itertools.count(1     ):
                     _A  :			int											=      -1 if j % 2 == 0 else +1
                     _A  :			Optional[Any]											=      (j * j * 3 - j) // 2
                     if index > i:
                            break
                     item += partitions[i - index] * sign
                     item %= number
                     index += j
                     if index > i:
                            break
                     item += partitions[i - index] * sign
                     item %= number

              if item == 0:
                     return i
              partitions.append(lowerCamelCase     )

       return 0


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   print(f"""{solution() = }""")






