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