#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  vector<int> A(N);
  cin >> N;
  int i = 0;
  while (i < N) {
    cin >> A.at(i);
    i++;
  }
  for (int j = 0; j < N; j++) {
    int maxa = 0;
    for (int k = 0; k < N; k++) {
      if (k != j) {
        maxa = max(maxa, A.at(k));
      }
    }
    cout << maxa << endl;
  }
}
