#include <bits/stdc++.h>
using namespace std;
int main() {
  int tmp, max, n, A[200001];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < n; i++) {
    tmp = A[i];
    A[i] = 0;
    max = 0;
    for (int i = 0; i < n; i++) {
      if (A[i] > max) max = A[i];
    }
    A[i] = tmp;
    cout << max << endl;
  }
  return 0;
}
