






def    a__    (	A       ):
   lowercase__    :						Tuple       =			len(A       )
   for cycle_start in range(0		,					array_len - 1       ):
      lowercase__    :						Dict       =			array[cycle_start]

      lowercase__    :						List[str]       =			cycle_start
      for i in range(cycle_start + 1		,					A       ):
         if array[i] < item:
            pos += 1

      if pos == cycle_start:
         continue

      while item == array[pos]:
         pos += 1

      lowercase__    :						int       =			item, array[pos]
      while pos != cycle_start:
         lowercase__    :						Any       =			cycle_start
         for i in range(cycle_start + 1		,					A       ):
            if array[i] < item:
               pos += 1

         while item == array[pos]:
            pos += 1

         lowercase__    :						Dict       =			item, array[pos]

   return array


if __name__ == "__main__":
 assert cycle_sort([4, 5, 3, 2, 1]) == [1, 2, 3, 4, 5]
 assert cycle_sort([0, 1, -10, 15, 2, -2]) == [-10, -2, 0, 1, 2, 15]










def    UpperCamelCase__  (   UpperCAmelCase     )     ->		tuple[int, int]:







							"""simple docstring"""





							if len(UpperCAmelCase     ) == 1:
														return a[0], a[0]
							else:
														# split A into half.
														_a  :    Union[str, Any]			=						a[: len(UpperCAmelCase     ) // 2]
														_a  :    Optional[Any]			=						a[len(UpperCAmelCase     ) // 2 :]

														# 2 sub problems, 1/2 of original size.
														_a		,					_a  :    Union[str, Any]			=						max_difference(UpperCAmelCase     )
														_a		,					_a  :    List[Any]			=						max_difference(UpperCAmelCase     )

														# get min of first and max of second
														# linear time
														_a  :    Union[str, Any]			=						min(UpperCAmelCase     )
														_a  :    Any			=						max(UpperCAmelCase     )

														# 3 cases, either (small1, big1),
														# (min_first, max_second), (small2, big2)
														# constant comparisons
														if biga - smalla > max_second - min_first and biga - smalla > biga - smalla:
																					return smalla, biga
														elif biga - smalla > max_second - min_first:
																					return smalla, biga
														else:
																					return min_first, max_second


if __name__ == "__main__":
						import doctest

						doctest.testmod()