#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    B = A;
    B[i] = 0;
    long long max = *max_element(B.begin(), B.end());
    cout << max << endl;
  }
  return 0;
}
