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