int main() {
int n, temp, val = 0;
scanf("%d", &n);
int m[n + 1];
for (int i = 0; i < n + 1; i++) {
scanf("%d ", &m[i]);
}
for (int k = 0; k < n + 1; k++) {
if (m[n] < m[k]) {
temp = m[n];
m[n] = m[k];
m[k] = temp;
}
}
while (val < n + 1) {
printf("%d ", m[val]);
val++;
}
return 0;
}