'''simple docstring'''




from __future__ import annotations

from collections.abc import Iterable, Iterator
from dataclasses import dataclass

__UpperCAmelCase												=(3, 9, -1_1, 0, 7, 5, 1, -1)
__UpperCAmelCase												=(4, 6, 2, 0, 8, 1_0, 3, -2)




@dataclass
class    a__				:
					lowerCamelCase  :					int							=4_2
					lowerCamelCase  :					Tuple							=4_2




class    a__				:






					def __init__(			self		:		str  ,    a		:		Iterable[int]   ):





									"""simple docstring"""



									__lowerCamelCase          =  None
									for i in sorted(a  ,    reverse=a   ):
													__lowerCamelCase          =  Node(a  ,    self.head   )






					def __iter__(			self		:		Any   ):





									"""simple docstring"""



									__lowerCamelCase          =  self.head
									while node:
													yield node.data
													__lowerCamelCase          =  node.next_node






					def __len__(			self		:		Tuple   ):





									"""simple docstring"""



									return sum(1 for _ in self   )






					def __str__(			self		:		Tuple   ):





									"""simple docstring"""



									return " -> ".join([str(a   ) for node in self]   )






def __lowerCAmelCase			(							UpperCamelCase__    ,  UpperCamelCase__    )     ->   SortedLinkedList:
				return SortedLinkedList(list(_lowerCAmelCase    ) + list(_lowerCAmelCase    )    )


if __name__ == "__main__":
		import doctest

		doctest.testmod()
		__UpperCAmelCase												=SortedLinkedList
		print(merge_lists(SSL(test_data_odd), SSL(test_data_even)))

'''simple docstring'''




def __lowerCAmelCase			(							UpperCamelCase__    )     ->   str:
    __lowerCamelCase          =  []
    __lowerCamelCase          =  set({'''(''', '''[''', '''{'''}    )
    __lowerCamelCase          =  set({''')''', ''']''', '''}'''}    )
    __lowerCamelCase          =  {'''{''': '''}''', '''[''': ''']''', '''(''': ''')'''}

    for i in range(len(UpperCamelCase__    )    ):
        if s[i] in open_brackets:
            stack.append(s[i]    )

        elif s[i] in closed_brackets and (
            len(UpperCamelCase__    ) == 0 or (len(UpperCamelCase__    ) > 0 and open_to_closed[stack.pop()] != s[i])
        ):
            return False

    return len(UpperCamelCase__    ) == 0






def __lowerCAmelCase			(							)     ->   Union[str, Any]:
    __lowerCamelCase          =  input('''Enter sequence of brackets: '''    )
    if is_balanced(UpperCamelCase__    ):
        print(UpperCamelCase__    ,  '''is balanced'''    )
    else:
        print(UpperCamelCase__    ,  '''is not balanced'''    )


if __name__ == "__main__":
  main()
