#include <iostream>
using namespace std;
int main()
{
int n, i, p, q, j, aux;
cin >> n >> p >> q;
int v[n], m[n];
for (i=0; i<n; i++)
{
cin >> v[i];
m[i]=v[i];
}
for (i=0; i<n; i++) cout << v[i] << " ";
cout << endl;
for (i=p; i<=q-1; i++)
for (j=i+1; j<=q; j++)
if (v[i]<v[j])
{
aux=v[i];
v[i]=v[j];
v[j]=aux;
}
for (i=0; i<n; i++) cout << v[i] << " ";
cout << endl;
for (i=0; i<n; i++) cout << m[i] << " ";
return 0;
}