

def 				__a							(       __A						):
    SCREAMING_SNAKE_CASE__         =    [list(__A						) for row in matrix]
    if matrix and isinstance(__A			,							__A						):
        if isinstance(matrix[0]			,							__A						):
            SCREAMING_SNAKE_CASE__         =    0
            for row in matrix:
                if prev_len == 0:
                    SCREAMING_SNAKE_CASE__         =    len(__A						)
                    SCREAMING_SNAKE_CASE__         =    True
                else:
                    SCREAMING_SNAKE_CASE__         =    prev_len == len(__A						)
        else:
            SCREAMING_SNAKE_CASE__         =    True
    else:
        SCREAMING_SNAKE_CASE__         =    False

    return result





def 				__a							(       __A						):





    if check_matrix(__A						) and len(__A						) > 0:
        SCREAMING_SNAKE_CASE__         =    [list(__A						) for row in a]
        SCREAMING_SNAKE_CASE__         =    len(__A						)
        if isinstance(a[0]			,							__A						):
            SCREAMING_SNAKE_CASE__         =    len(a[0]						)
        else:
            for dat in a:
                print(__A						)
            return

        # horizotal printing increasing
        for i in range(0			,							__A						):
            print(a[0][i]						)
        # vertical printing down
        for i in range(1			,							__A						):
            print(a[i][mat_col - 1]						)
        # horizotal printing decreasing
        if mat_row > 1:
            for i in range(mat_col - 2			,							-1			,							-1						):
                print(a[mat_row - 1][i]						)
        # vertical printing up
        for i in range(mat_row - 2			,							0			,							-1						):
            print(a[i][0]						)
        SCREAMING_SNAKE_CASE__         =    [row[1 : mat_col - 1] for row in a[1 : mat_row - 1]]
        if len(__A						) > 0:
            spiral_print_clockwise(__A						)
        else:
            return
    else:
        print("Not a valid matrix"						)
        return





def 				__a							(       __A						):





    if matrix:
        return list(matrix.pop(0						)						) + spiral_traversal(list(zip(*__A						)						)[::-1]						)
    else:
        return []


# driver code
if __name__ == "__main__":
  import doctest

  doctest.testmod()

  A__										=      [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
  spiral_print_clockwise(a)










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