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