#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
long double const pi = std::acos(-1.0L);
const int INF = 1001001001;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) cin >> a[i];
  int ans;
  for (int i = 0; i < (n); ++i) {
    ans = 0;
    for (int j = 0; j < (n); ++j) {
      if (i != j) ans = max(ans, a[j]);
    }
    cout << ans << endl;
  }
  return 0;
}
