#include <bits/stdc++.h>
int main(void) {
  int N;
  scanf("%d", &N);
  int i;
  int A[N];
  for (i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int tmp;
  int ans;
  int mx;
  for (i = 0; i < N; i++) {
    mx = 0;
    tmp = A[i];
    A[i] = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] > mx) mx = A[j];
    }
    printf("%d\n", mx);
    A[i] = tmp;
  }
  return 0;
}
