"""simple docstring"""


import unittest

import numpy as np

from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available

from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs


if is_torch_available():
	import torch

if is_vision_available():
	from PIL import Image

	from transformers import GLPNImageProcessor






class   __UpperCAmelCase		(      unittest.TestCase      ):

				def __init__( self      ,					_lowerCamelCase      ,					_lowerCamelCase=7      ,					_lowerCamelCase=3      ,					_lowerCamelCase=18      ,					_lowerCamelCase=30      ,					_lowerCamelCase=400      ,					_lowerCamelCase=True      ,					_lowerCamelCase=32      ,					_lowerCamelCase=True      ,					):
										lowerCamelCase__   =parent
										lowerCamelCase__   =batch_size
										lowerCamelCase__   =num_channels
										lowerCamelCase__   =image_size
										lowerCamelCase__   =min_resolution
										lowerCamelCase__   =max_resolution
										lowerCamelCase__   =do_resize
										lowerCamelCase__   =size_divisor
										lowerCamelCase__   =do_rescale






				def 						_a      ( self ):
										return {
										    "do_resize": self.do_resize,
										    "size_divisor": self.size_divisor,
										    "do_rescale": self.do_rescale,
										}






@require_torch
@require_vision
class   __UpperCAmelCase		(      __lowerCAmelCase , unittest.TestCase      ):
				A__ :  Dict    				=			GLPNImageProcessor if is_vision_available() else None

				def 						_a      ( self ):
										lowerCamelCase__   =GLPNImageProcessingTester(self )

				@property
				def 						_a      ( self ):
										return self.image_processor_tester.prepare_image_processor_dict()

				def 						_a      ( self ):
										lowerCamelCase__   =self.image_processing_class(**self.image_processor_dict )
										self.assertTrue(hasattr(_lowerCamelCase      ,					"do_resize" ) )
										self.assertTrue(hasattr(_lowerCamelCase      ,					"size_divisor" ) )
										self.assertTrue(hasattr(_lowerCamelCase      ,					"resample" ) )
										self.assertTrue(hasattr(_lowerCamelCase      ,					"do_rescale" ) )

				def 						_a      ( self ):
										pass

				def 						_a      ( self ):
										# Initialize image_processing
										lowerCamelCase__   =self.image_processing_class(**self.image_processor_dict )
										# create random PIL images
										lowerCamelCase__   =prepare_image_inputs(self.image_processor_tester      ,					equal_resolution=_lowerCamelCase )
										for image in image_inputs:
																self.assertIsInstance(_lowerCamelCase      ,					Image.Image )

										# Test not batched input (GLPNImageProcessor doesn't support batching)
										lowerCamelCase__   =image_processing(image_inputs[0]      ,					return_tensors="pt" ).pixel_values
										self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0 )
										self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0 )

				def 						_a      ( self ):
										# Initialize image_processing
										lowerCamelCase__   =self.image_processing_class(**self.image_processor_dict )
										# create random numpy tensors
										lowerCamelCase__   =prepare_image_inputs(self.image_processor_tester      ,					equal_resolution=_lowerCamelCase      ,					numpify=_lowerCamelCase )
										for image in image_inputs:
																self.assertIsInstance(_lowerCamelCase      ,					np.ndarray )

										# Test not batched input (GLPNImageProcessor doesn't support batching)
										lowerCamelCase__   =image_processing(image_inputs[0]      ,					return_tensors="pt" ).pixel_values
										self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0 )
										self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 0 )






				def 						_a      ( self ):
										# Initialize image_processing
										lowerCamelCase__   =self.image_processing_class(**self.image_processor_dict )
										# create random PyTorch tensors
										lowerCamelCase__   =prepare_image_inputs(self.image_processor_tester      ,					equal_resolution=_lowerCamelCase      ,					torchify=_lowerCamelCase )
										for image in image_inputs:
																self.assertIsInstance(_lowerCamelCase      ,					torch.Tensor )

										# Test not batched input (GLPNImageProcessor doesn't support batching)
										lowerCamelCase__   =image_processing(image_inputs[0]      ,					return_tensors="pt" ).pixel_values
										self.assertTrue(encoded_images.shape[-1] % self.image_processor_tester.size_divisor == 0 )
										self.assertTrue(encoded_images.shape[-2] % self.image_processor_tester.size_divisor == 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))


