#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int M = N - 1;
  for (int i = 0; i < N; i++) {
    vector<int> vec2 = vec;
    vec2.at(i) = 0;
    sort(vec2.begin(), vec2.end());
    cout << vec2.at(M) << endl;
  }
}
