#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int a[200005], b[20005], n, l;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  sort(a, a + n + 1);
  for (int i = 1; i <= n; i++) {
    a[i] = 0;
    sort(a, a + n + 1);
    printf("%d\n", a[n]);
    for (int o = 1; o <= n; o++) {
      a[o] = b[o];
    }
  }
}
