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