#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < (N); ++i) cin >> A[i];
  for (int i = 0; i < (N); ++i) {
    int res = 0;
    for (int j = 0; j < (N); ++j) {
      if (i == j)
        continue;
      else
        res = max(res, A[j]);
    }
    cout << res << endl;
  }
}
