#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];
  }
  for (int i = 0; i < N; i++) {
    int max, temp;
    temp = a[i];
    a[i] = 0;
    max = *max_element(a.begin(), a.end());
    cout << max << endl;
    a[i] = temp;
  }
  return 0;
}
