#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = long long int;
int main() {
  int N;
  cin >> N;
  vi vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec[i];
  }
  for (int i = 0; i < N; i++) {
    vi v = vec;
    v[i] = -1;
    sort(v.begin(), v.end());
    cout << v[N - 1] << endl;
  }
}
