#include <bits/stdc++.h>
using namespace std;
constexpr auto inf = 1e9;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& x : a) {
    cin >> x;
  }
  for (int i = 0; i < n; i++) {
    int ans = 0;
    int tmp = 0;
    tmp = a[i];
    a[i] = -1;
    ans = *max_element((a).begin(), (a).end());
    a[i] = tmp;
    cout << ans << endl;
  }
  return 0;
}
