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