#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> a, b, mem(200000, 0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    b.push_back(tmp);
  }
  b = a;
  for (int i = 0; i < b.size(); i++) {
    b.erase(b.begin() + i);
    sort(b.begin(), b.end());
    cout << b[n - 1] << endl;
    b = a;
  }
  return 0;
}
