#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> unko(N);
  int kari;
  int comp;
  for (int i = 0; i < N; i++) {
    cin >> unko.at(i);
  }
  for (int i = 0; i < N; i++) {
    kari = unko.at(i);
    unko.at(i) = 0;
    comp = 0;
    for (int j = 0; j < N; j++) {
      comp = max(comp, unko.at(j));
    }
    cout << comp << endl;
    unko.at(i) = kari;
  }
}
