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