"""simple docstring"""


import numpy as np
from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey





def      lowerCamelCase_					(   __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase  ,       __lowerCAmelCase							)				->   np.ndarray:




						'''simple docstring'''



						if (ksize % 2) == 0:
												lowerCamelCase__   =ksize + 1
						lowerCamelCase__   =np.zeros((ksize, ksize)  ,       dtype=np.floataa							)

						# each value
						for y in range(__lowerCAmelCase							):
												for x in range(__lowerCAmelCase							):
																		# distance from center
																		lowerCamelCase__   =x - ksize // 2
																		lowerCamelCase__   =y - ksize // 2

																		# degree to radiant
																		lowerCamelCase__   =theta / 180 * np.pi
																		lowerCamelCase__   =np.cos(_theta							)
																		lowerCamelCase__   =np.sin(_theta							)

																		# get kernel x
																		lowerCamelCase__   =cos_theta * px + sin_theta * py

																		# get kernel y
																		lowerCamelCase__   =-sin_theta * px + cos_theta * py

																		# fill kernel
																		lowerCamelCase__   =np.exp(
																		    -(_x**2 + gamma**2 * _y**2) / (2 * sigma**2)							) * np.cos(2 * np.pi * _x / lambd + psi							)

						return gabor


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	# read original image
	a				=imread('../image_data/lena.jpg')
	# turn image in gray scale value
	a				=cvtColor(img, COLOR_BGR2GRAY)

	# Apply multiple Kernel to detect edges
	a				=np.zeros(gray.shape[:2])
	for theta in [0, 30, 60, 90, 120, 150]:
		a				=gabor_filter_kernel(10, 8, theta, 10, 0, 0)
		out += filteraD(gray, CV_8UC3, kernel_aa)
	a				=out / out.max() * 255
	a				=out.astype(np.uinta)

	imshow('Original', gray)
	imshow('Gabor filter with 20x20 mask and 6 directions', out)

	waitKey(0)



"""simple docstring"""


def      lowerCamelCase_					(   __lowerCAmelCase							)				->   list:




						'''simple docstring'''



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

						lowerCamelCase__   =[]

						def generate(__lowerCAmelCase  ,       __lowerCAmelCase							):
												lowerCamelCase__   =[0] * n
												res.append(tuple(__lowerCAmelCase							)							)

												lowerCamelCase__   =0
												while i < n:
																		if c[i] < i:
																								if i % 2 == 0:
																														lowerCamelCase__   , lowerCamelCase__   =arr[i], arr[0]
																								else:
																														lowerCamelCase__   , lowerCamelCase__   =arr[i], arr[c[i]]
																								res.append(tuple(__lowerCAmelCase							)							)
																								c[i] += 1
																								lowerCamelCase__   =0
																		else:
																								lowerCamelCase__   =0
																								i += 1

						generate(len(__lowerCAmelCase							)  ,       __lowerCAmelCase							)
						return res


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


