#962. [基础]对序列操作

[基础]对序列操作

No submission language available for this problem.

Background

Special for beginners, ^_^

Description

有 n 个整数的序列,你需要按如下步骤进行调整:

  1. 找到最大值
  2. 找到最小值
  3. 在序列中将最大值和最小值进行交换
  4. 重新输出该序列

注意测试数据保证序列中无重复数值

Format

Input

第一行一个整数 n (1 <= n<=100)

第二行 n 个互不相同的整数

Output

一行 n 个整数, 表示在最大最小值交换后的序列。

Samples

2
123 500
500 123
10
1 2 3 4 5 6 7 8 9 0
1 2 3 4 5 6 7 8 0 9

Limitation

1s, 1024KiB for each test case.