#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int save, amax = 0;
  for (int i = 0; i < n; i++) {
    save = a[i];
    a[i] = 0;
    for (int j = 0; j < n; j++) {
      amax = max(amax, a[j]);
    }
    cout << amax << endl;
    amax = 0;
    a[i] = save;
  }
}
