



'''simple docstring'''






import random


def  snake_case_     (					_lowerCAmelCase  :						list   ,      _lowerCAmelCase  :						str  )      ->   tuple:
							UpperCAmelCase							,		UpperCAmelCase							,		UpperCAmelCase :       Tuple 							=		[], [], []
							for element in data:
														if element < pivot:
																					less.append(_lowerCAmelCase  )
														elif element > pivot:
																					greater.append(_lowerCAmelCase  )
														else:
																					equal.append(_lowerCAmelCase  )
							return less, equal, greater




def  snake_case_     (					_lowerCAmelCase  :						list   ,      _lowerCAmelCase  :						int  )      ->   Dict:
							# index = len(items) // 2 when trying to find the median
							#   (value of index when items is sorted)

							# invalid input
							if index >= len(_lowerCAmelCase  ) or index < 0:
														return None

							UpperCAmelCase :       int 							=		items[random.randint(0   ,      len(_lowerCAmelCase  ) - 1  )]
							UpperCAmelCase :       List[Any] 							=		0
							UpperCAmelCase							,		UpperCAmelCase							,		UpperCAmelCase :       Any 							=		_partition(_lowerCAmelCase   ,      _lowerCAmelCase  )
							UpperCAmelCase :       List[str] 							=		len(_lowerCAmelCase  )
							UpperCAmelCase :       str 							=		len(_lowerCAmelCase  )

							# index is the pivot
							if m <= index < m + count:
														return pivot
							# must be in smaller
							elif m > index:
														return quick_select(_lowerCAmelCase   ,      _lowerCAmelCase  )
							# must be in larger
							else:
														return quick_select(_lowerCAmelCase   ,      index - (m + count)  )







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

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

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

				return len(a__  ) == 0


def     __lowerCAmelCase			(			)       ->  Dict:
				__a										=    input('''Enter sequence of brackets: '''  )
				if is_balanced(a__  ):
								print(a__						,    '''is balanced'''  )
				else:
								print(a__						,    '''is not balanced'''  )


if __name__ == "__main__":
					main()