#include <bits/stdc++.h>
using namespace std;
static const long k10E7 = 1000000007;
int main() {
  long n;
  cin >> n;
  vector<long> an(n);
  for (long& a : an) {
    cin >> a;
  }
  for (long i = 0; i < n; i++) {
    const long ai = an[i];
    an[i] = 0;
    cout << *max_element(an.begin(), an.end()) << endl;
    an[i] = ai;
  }
  return 0;
}
