


from typing import Any



class 	__lowerCamelCase			:







       def __init__(			self: Union[str, Any],A_: Any					):






            '''simple docstring'''




            __UpperCamelCase =			data
            __UpperCamelCase =			None



class 	__lowerCamelCase			:







       def __init__(			self: Tuple					):






            '''simple docstring'''




            __UpperCamelCase =			None







       def 		snake_case_	(			self: Tuple					):






            '''simple docstring'''




            __UpperCamelCase =			self.head
            while temp is not None:
                 print(temp.data,end=' '					)
                 __UpperCamelCase =			temp.next
            print()







       def 		snake_case_	(			self: Union[str, Any],A_: Any					):






            '''simple docstring'''




            __UpperCamelCase =			Node(A_					)
            __UpperCamelCase =			self.head
            __UpperCamelCase =			new_node







       def 		snake_case_	(			self: str,A_: Union[str, Any],A_: Optional[Any]					):






            '''simple docstring'''




            if node_data_a == node_data_a:
                 return
            else:
                 __UpperCamelCase =			self.head
                 while node_a is not None and node_a.data != node_data_a:
                      __UpperCamelCase =			node_a.next

                 __UpperCamelCase =			self.head
                 while node_a is not None and node_a.data != node_data_a:
                      __UpperCamelCase =			node_a.next

                 if node_a is None or node_a is None:
                      return

                 __UpperCamelCase,    __UpperCamelCase =			node_a.data, node_a.data


if __name__ == "__main__":
    __snake_case   							=						LinkedList()
    for i in range(5, 0, -1):
        ll.push(i)

    ll.print_list()

    ll.swap_nodes(1, 4)
    print('''After swapping''')
    ll.print_list()






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]



