#include <bits/stdc++.h>
int cmpfunc(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
int main(void) {
  int N;
  scanf("%d", &N);
  int array[N];
  int res[N];
  int copy[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &array[i]);
    copy[i] = array[i];
  }
  int c = 0;
  for (int i = 0; i < N; i++) {
    c = array[i];
    array[i] = 0;
    qsort(array, N, sizeof(int), cmpfunc);
    res[i] = array[0];
    for (int i = 0; i < N; i++) {
      array[i] = copy[i];
    }
  }
  for (int i = 0; i < N; i++) {
    printf("%d\n", res[i]);
  }
  return EXIT_SUCCESS;
}
