


"""simple docstring"""
def   _a			( _SCREAMING_SNAKE_CASE			)      ->			bool:
							snake_case_          =						set()
							# To detect a back edge, keep track of vertices currently in the recursion stack
							snake_case_          =						set()
							return any(
							    node not in visited and depth_first_search(_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			)
							    for node in graph			)







def   _a			( _SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			)      ->			bool:
							visited.add(_SCREAMING_SNAKE_CASE			)
							rec_stk.add(_SCREAMING_SNAKE_CASE			)

							for node in graph[vertex]:
														if node not in visited:
																					if depth_first_search(_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			):
																												return True
														elif node in rec_stk:
																					return True

    # The node needs to be removed from recursion stack before function ends
							rec_stk.remove(_SCREAMING_SNAKE_CASE			)
							return False


if __name__ == "__main__":
				from doctest import testmod

				testmod()







"""simple docstring"""
def   _a			( _SCREAMING_SNAKE_CASE			)      ->			list:

							if len(_SCREAMING_SNAKE_CASE			) <= 1:
														return [tuple(_SCREAMING_SNAKE_CASE			)]

							snake_case_          =						[]

							def generate(_SCREAMING_SNAKE_CASE			,	_SCREAMING_SNAKE_CASE			):
														if k == 1:
																					res.append(tuple(arr[:]			)			)
																					return

														generate(k - 1			,	_SCREAMING_SNAKE_CASE			)

														for i in range(k - 1			):
																					if k % 2 == 0:  # k is even
																												snake_case_    ,  snake_case_          =						arr[k - 1], arr[i]
																					else:  # k is odd
																												snake_case_    ,  snake_case_          =						arr[k - 1], arr[0]
																					generate(k - 1			,	_SCREAMING_SNAKE_CASE			)

							generate(len(_SCREAMING_SNAKE_CASE			)			,	_SCREAMING_SNAKE_CASE			)
							return res


if __name__ == "__main__":
				__SCREAMING_SNAKE_CASE							:      List[Any]						=      input('Enter numbers separated by a comma:\n').strip()
				__SCREAMING_SNAKE_CASE							:      str						=      [int(item) for item in user_input.split(',')]
				print(heaps(arr))



