#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, a[200000], m;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    m = a[i];
    a[i] = 0;
    sort(a, a + n);
    cout << a[n - 1] << endl;
    a[i] = m;
  }
  return 0;
}
