#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N - 1];
  for (int i = 0; i < N; i++) cin >> A[i];
  int max = 0;
  for (int i = 0; i < N; i++) {
    int B = A[i];
    A[i] = 0;
    sort(A, A + (sizeof(A) / sizeof(A[0])));
    max = A[N - 1];
    cout << max << endl;
    max = 0;
    A[i] = B;
  }
  return 0;
}
