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