#include <stdio.h>

int main(void)

{

int n;

scanf("%d", &n);

int arr[100] = { 0 };

for (int i = 1; i <= n; i++) {

scanf("%d", &arr[i]);

}

int temp;

scanf("%d", &temp);

int c;

for (int i = 1; i <= n + 1; i++) {

if (arr[i] >= temp) {

c = arr[i];

arr[i] = temp;

temp = c;

}

}

arr[n + 1] = temp;

for (int i = 1; i <= n + 1; i++) {

printf("%d ", arr[i]);

}

return 0;

}