cho.sh
Notes
Loading...

Lexicographically Largest Sort

Time limit

2s

Memory limit

128 MB

Problem

You are given an array A of size N. All elements of the array are distinct.

In one operation, you may swap two adjacent elements. You may perform at most S operations. Among all arrays obtainable this way, print the lexicographically largest one.

Input

The first line contains a positive integer N. N is at most 50.

The second line contains the N elements of array A in order. The elements are distinct positive integers between 1 and 1,000,000, inclusive.

The third line contains a nonnegative integer S. S is at most 1,000,000.

Output

Print the array satisfying the condition on the first line, with elements separated by spaces.