#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
int n;
vector<int> a;
int main(void) {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;
    a.push_back(ai);
  }
  for (int i = 0; i < n; i++) {
    int tmp = a[i];
    a[i] = 0;
    int m = *max_element(a.begin(), a.end());
    cout << m << endl;
    a[i] = tmp;
  }
  return 0;
}
