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