#include
using namespace std;
int N;
void SelectionSort(int A[], int s, int m)
{
int p,cun;
for (int i = m; i >0; i--)
{
p=0;
for (int j = 1; j < i; j++)
if (A[s + p] > A[s + j])
p=j;
cun = A[s+i-1];
A[s + i-1] = A[s + p];
A[s + p] = cun;
}
}
int main()
{
int s, m, * p;
cin >> N;
p = new int[N];
for (int k = 0; k < N; k++)
cin >> *(p + k);
cin >> s >> m;
SelectionSort(p, s, m);
for (int k = 0; k < N; k++)
cout << *(p + k) << " ";
delete[]p;
p = 0;
return 0;
}