#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> A[i];
  }
  for (int i = 0; i < (int)(N); i++) {
    ll tmp = A[i];
    vector<ll> tmp_A = A;
    tmp_A[i] = 0;
    sort(tmp_A.rbegin(), tmp_A.rend());
    cout << tmp_A[0] << endl;
  }
  return 0;
}
