


'''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))





'''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))

