#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int a[205];
    cin >> n;
   
    int mx = 0;
    int mxind = 0;
	for(int i = 0;i<n;i++)
	{
		cin >> a[i];
        if(a[i]>mx)
        {
            mx = a[i];
            mxind = i;
        }
	}
    int y;
    cin >> y;
    for(int i = n-1;i>=mxind;i--)
    {
        a[i+1] = a[i];
    }
    a[mxind] = y;
   
    for(int i = 0;i<n+1;i++)
	{
		cout <<a[i]<<" ";
	}
   // cout << mi;

	return 0;
}
/**************************************************************
	Problem: 1214
	User: mariooo
	Language: C++
	Result: Wrong Answer
****************************************************************/