#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++) {
    int temp[N];
    memcpy(temp, row, sizeof(row));
    temp[i] = 0;
    max = 0;
    for (int j = 0; j < N; j++) {
      if (max < temp[j]) max = temp[j];
    }
    printf("%d\n", max);
  }
  return 0;
}
