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