#include <bits/stdc++.h>
int main(void) {
  int n;
  int a[200000];
  int b[200000];
  int i, j, k;
  int max = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    b[i] = a[i];
  }
  for (i = 0; i < n; i++) {
    b[i] = 0;
    max = 0;
    for (j = 0; j < n; j++) {
      if (b[j] > max) {
        max = b[j];
      }
    }
    printf("%d\n", max);
    b[i] = a[i];
  }
  return 0;
}
