#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int maximum = -9999;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int k = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (j != i) {
        if (maximum < arr[j]) maximum = arr[j];
      }
    }
    cout << maximum << endl;
    maximum = -9999;
  }
  return 0;
}
