#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;
    vector<int> tmp(n, 0);
    for (int l = 0; l < n; l++) {
      if (l == i) {
        tmp[l] = 0;
        continue;
      }
      tmp[l] = a[l];
    }
    ans = *max_element((tmp).begin(), (tmp).end());
    cout << ans << endl;
  }
  return 0;
}
