#include <bits/stdc++.h>
using namespace std;
int largest(int arr[], int n) { return *max_element(arr, arr + n); }
int main() {
  int n, i, temp = 0;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    temp = a[i];
    a[i] = 0;
    cout << largest(a, n) << "\n";
    a[i] = temp;
  }
}
