#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  cin >> n;
  int arr[n], arr1[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i == j)
        arr1[j] = 0;
      else
        arr1[j] = arr[j];
    }
    sort(arr1, arr1 + n);
    cout << arr1[n - 1] << endl;
  }
}
