#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  vector<long long> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n; i++) {
    int max = s[0];
    for (int j = 0; j < n; j++) {
      if (j != i) {
        if (s[j] > max) {
          max = s[j];
        }
      }
    }
    cout << max << endl;
  }
  return 0;
}
