#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);
  }
  for (int i = 0; i < N; i++) {
    vector<int> vex(N);
    for (int j = 0; j < N; j++) {
      vex.at(j) = vec.at(j);
    }
    vex.at(i) = 0;
    sort(vex.begin(), vex.end());
    cout << vex.at(N - 1) << endl;
  }
}
