#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int main() {
  ll n;
  cin >> n;
  ll a[220000];
  for (ll i = ll(0); i < ll(n); i++) cin >> a[i];
  ll ans = 0;
  for (ll i = ll(0); i < ll(n); i++) {
    for (ll j = ll(0); j < ll(n); j++) {
      if (i == j) continue;
      ans = max(ans, a[j]);
    }
    cout << ans << endl;
    ans = 0;
  }
}
