#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
int main(void) {
  lint N;
  cin >> N;
  vector<lint> A(N);
  for (lint i = 0; i < (N); i++) cin >> A[i];
  for (int i = 0; i < N; ++i) {
    lint ans = 0;
    for (int j = 0; j < N; ++j) {
      if (i == j) continue;
      ans = max(ans, A[j]);
    }
    cout << ans << endl;
  }
  return 0;
}
