


'''simple docstring'''







from tempfile import TemporaryDirectory
from unittest import TestCase
from unittest.mock import MagicMock, patch

from transformers import AutoModel, TFAutoModel
from transformers.onnx import FeaturesManager
from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch
@require_torch
@require_tf
class 						UpperCamelCase__       (			SCREAMING_SNAKE_CASE_						):



     """simple docstring"""






     def a						(			self ):

            '''simple docstring'''

            _lowerCAmelCase     :				int       =							SMALL_MODEL_IDENTIFIER
            _lowerCAmelCase     :				str       =							'pt'
            _lowerCAmelCase     :				Tuple       =							'tf'







     def a						(			self   ,						snake_case__ ):

            '''simple docstring'''

            _lowerCAmelCase     :				List[Any]       =							AutoModel.from_pretrained(self.test_model )
            model_pt.save_pretrained(snake_case__ )







     def a						(			self   ,						snake_case__ ):

            '''simple docstring'''

            _lowerCAmelCase     :				Dict       =							TFAutoModel.from_pretrained(self.test_model   ,						from_pt=snake_case__ )
            model_tf.save_pretrained(snake_case__ )







     def a						(			self ):

            '''simple docstring'''

            _lowerCAmelCase     :				Dict       =							'mock_framework'

            # Framework provided - return whatever the user provides
            _lowerCAmelCase     :				Optional[Any]       =							FeaturesManager.determine_framework(self.test_model   ,						snake_case__ )
            self.assertEqual(snake_case__   ,						snake_case__ )

            # Local checkpoint and framework provided - return provided framework
            # PyTorch checkpoint
            with TemporaryDirectory() as local_pt_ckpt:
                   self._setup_pt_ckpt(snake_case__ )
                   _lowerCAmelCase     :				int       =							FeaturesManager.determine_framework(snake_case__   ,						snake_case__ )
                   self.assertEqual(snake_case__   ,						snake_case__ )

            # TensorFlow checkpoint
            with TemporaryDirectory() as local_tf_ckpt:
                   self._setup_tf_ckpt(snake_case__ )
                   _lowerCAmelCase     :				List[str]       =							FeaturesManager.determine_framework(snake_case__   ,						snake_case__ )
                   self.assertEqual(snake_case__   ,						snake_case__ )







     def a						(			self ):

            '''simple docstring'''

            with TemporaryDirectory() as local_pt_ckpt:
                   self._setup_pt_ckpt(snake_case__ )
                   _lowerCAmelCase     :				List[Any]       =							FeaturesManager.determine_framework(snake_case__ )
                   self.assertEqual(snake_case__   ,						self.framework_pt )

            # TensorFlow checkpoint
            with TemporaryDirectory() as local_tf_ckpt:
                   self._setup_tf_ckpt(snake_case__ )
                   _lowerCAmelCase     :				List[Any]       =							FeaturesManager.determine_framework(snake_case__ )
                   self.assertEqual(snake_case__   ,						self.framework_tf )

            # Invalid local checkpoint
            with TemporaryDirectory() as local_invalid_ckpt:
                   with self.assertRaises(snake_case__ ):
                          _lowerCAmelCase     :				Optional[Any]       =							FeaturesManager.determine_framework(snake_case__ )







     def a						(			self ):

            '''simple docstring'''

            _lowerCAmelCase     :				List[str]       =							MagicMock(return_value=snake_case__ )
            with patch('transformers.onnx.features.is_tf_available'   ,						snake_case__ ):
                   _lowerCAmelCase     :				Dict       =							FeaturesManager.determine_framework(self.test_model )
                   self.assertEqual(snake_case__   ,						self.framework_pt )

            # PyTorch not in environment -> use TensorFlow
            _lowerCAmelCase     :				int       =							MagicMock(return_value=snake_case__ )
            with patch('transformers.onnx.features.is_torch_available'   ,						snake_case__ ):
                   _lowerCAmelCase     :				Optional[Any]       =							FeaturesManager.determine_framework(self.test_model )
                   self.assertEqual(snake_case__   ,						self.framework_tf )

            # Both in environment -> use PyTorch
            _lowerCAmelCase     :				Tuple       =							MagicMock(return_value=snake_case__ )
            _lowerCAmelCase     :				Union[str, Any]       =							MagicMock(return_value=snake_case__ )
            with patch('transformers.onnx.features.is_tf_available'   ,						snake_case__ ), patch(
                'transformers.onnx.features.is_torch_available'   ,						snake_case__ ):
                   _lowerCAmelCase     :				Tuple       =							FeaturesManager.determine_framework(self.test_model )
                   self.assertEqual(snake_case__   ,						self.framework_pt )

            # Both not in environment -> raise error
            _lowerCAmelCase     :				Optional[int]       =							MagicMock(return_value=snake_case__ )
            _lowerCAmelCase     :				List[str]       =							MagicMock(return_value=snake_case__ )
            with patch('transformers.onnx.features.is_tf_available'   ,						snake_case__ ), patch(
                'transformers.onnx.features.is_torch_available'   ,						snake_case__ ):
                   with self.assertRaises(snake_case__ ):
                          _lowerCAmelCase     :				Tuple       =							FeaturesManager.determine_framework(self.test_model )





'''simple docstring'''







def       lowercase					(_A       ):







       """simple docstring"""







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

       _lowerCAmelCase     :				List[str]       =							[]

       def generate(_A ,    _A       ):
              _lowerCAmelCase     :				Any       =							[0] * n
              res.append(tuple(_A       )       )

              _lowerCAmelCase     :				Any       =							0
              while i < n:
                     if c[i] < i:
                            if i % 2 == 0:
                                   _lowerCAmelCase      ,  _lowerCAmelCase     :				Tuple       =							arr[i], arr[0]
                            else:
                                   _lowerCAmelCase      ,  _lowerCAmelCase     :				List[str]       =							arr[i], arr[c[i]]
                            res.append(tuple(_A       )       )
                            c[i] += 1
                            _lowerCAmelCase     :				Optional[int]       =							0
                     else:
                            _lowerCAmelCase     :				Any       =							0
                            i += 1

       generate(len(_A       ) ,    _A       )
       return res


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

