#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> a;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < n; i++) {
    vector<int> tmpa(a.size());
    copy(a.begin(), a.end(), tmpa.begin());
    tmpa.erase(tmpa.begin() + i);
    sort(tmpa.begin(), tmpa.end());
    cout << tmpa.back() << endl;
  }
}
