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