#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using namespace std;
int main() {
  ll n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < (n); ++i) cin >> v[i];
  for (ll i = 0; i < n; ++i) {
    ll res = 0;
    for (int j = 0; j < (n); ++j) {
      if (i == j) continue;
      res = max(res, v[j]);
    }
    cout << res << endl;
  }
  return 0;
}
