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