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